excel vba‎ > ‎

VBA - Application.GetOpenFilename

posted Oct 1, 2010, 2:21 AM by Roberto Felicini
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