VBA - Application.GetOpenFilename

Post date: Oct 1, 2010 9:21:38 AM

Path = ActiveWorkbook.Path

Dim fname As Variant

Dim a As String

a = MsgBox("Do you want import the Customer Master Data? ", vbYesNo, "Import")

If a = vbNo Then

MsgBox "User press the button NO!"


' // open file with variable cancell

ChDrive Path

fname = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", Title:="Choose Files", MultiSelect:=False)

If fname = False Then

MsgBox "User pressed cancel"


MsgBox "Press ENTER and wait until the import is Completed!", 0 + 64, "Moët Hennessy - BCP - Temporary Order Form" '

Workbooks.Open Filename:=fname

end if

end if