I\'m getting error type mismatch. Please help as I\'m new to VBA macro and not sure what I\'m doing. I just want the code to be able to select multiple files on search:
Like I mentioned in the comments above
You can't use myfile like that. You have to loop through the collection
See this example.
Sub Sample()
Dim myFile As Variant
Dim i As Integer
'Open File to search
myFile = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(myFile) Then '<~~ If user selects multiple file
For i = LBound(myFile) To UBound(myFile)
MsgBox myFile(i)
Next i
Else '<~~ If user selects single file
MsgBox myFile
End If
End Sub