Open Multiple Workbook in One Go Using Application.GetOpenFileName(MultiSelect:=True)
Example-1
Multiselect:=True, let you select multiple files in one go and store the location of all files in a variable and let you open one file or workbook at one time.
Note: It is important to note that the type of variable holding file or files name should be Variant.
Sub OpenFile()
On Error Resume Next
Dim str As Variant
Dim i As Integer
str = Application.GetOpenFilename(MultiSelect:=True)
Debug.Print str
For i = LBound(str) To UBound(str)
Debug.Print str(i)
'Workbooks.Open str(i)
'Debug.Print ActiveWorkbook.Name
'ActiveWorkbook.Close
Next
End Sub
Comments
Post a Comment