VBA - Selecting multiple files

Post date: Oct 1, 2010 9:25:19 AM

Sub GetImportFileName2()

Dim FileNames As Variant

Dim Msg As String

Dim I As Integer

FileNames = Application.GetOpenFilename(MultiSelect:=True)

If IsArray(FileNames) Then

Msg = "You selected:" & vbNewLine

For I = LBound(FileNames) To UBound(FileNames)

Msg = Msg & FileNames(i) & vbNewLine

Next i

MsgBox Msg

Else

MsgBox "No files were selected."

End If

End Sub