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
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
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