Open Existing Excel Workbook using VBA Macro - ScoreInExcel

Easy way to Learn Excel....

ads
Responsive Ads Here

Post Top Ad

Your Ad Spot

Tuesday 22 August 2017

Open Existing Excel Workbook using VBA Macro

Untitled Document In Microsoft Excel, you can open the excel workbook automatically using macro.There are multiple method to open the existing excel workbook. We will see few things with example. Open the Excel workbook where you want to place the macro coding to open existing workbook. Follow the below steps to complete the process.

Syntax:

Workbooks.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad)

Step 1:

Open workbook and press Alt + F11 to open the VBA Editor as shown in the below picture.

Step 2:

Copy the below code and paste it in VBA Editor and run the macro to open excel file automatically.
Sub Open_Excel_Workbook()
Workbooks.open Filename:="D:\Sample - Open Excel Workbook.xlsx"
End Sub

(OR)

Sub Open_Workbook()
Dim My_Filename As Variant
My_Filename = Application.GetOpenFilename(FileFilter:="Excel Files,*.xls*,*.xlsm*")
If My_Filename <> False Then
Workbooks.Open Filename:=My_Filename
End If
End Sub

You can use the above code to open the required various workbook. Thank You Visit Again!!! To learn more about Excel and Macros visit our ScoreInExcel website regularly.

No comments:

Post a Comment

Post Top Ad

Your Ad Spot