The following worked on my old installation of Outlook 2016 so it must be either a small typo or there is something wrong with the references.
The code is in Outlook 2016:
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
I get:
for this line:
myFile = Application.GetOpenFilename(MultiSelect:=True)
Here are my selected references:
I was able to get your test working (In Outlook 365) by doing the following:
Excel Object Reference Library 16.0
in the VBEExcel.Application
GetOpenFilename
method.Sub Sample()
Dim myFile As Variant
Dim i As Integer
Dim myApp As Excel.Application
Set myApp = New Excel.Application
'Open File to search
myFile = myApp.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
This creates a new instance of the Excel application for the duration your code is running.