Open Excel Files - Open Dialog - GetOpenFilename Method
The GetOpenFilename Method is a cousin to the CommonDialog. Some of the CommonDialog's tasks can he done with this method
GetOpenFilename Method (Displays the standard Open dialog box and gets a file name from the user without actually opening any files.)
Sub Open_Excel_File_Thru_VBA()
'----------------------------
' Coded for http://vbadud.blogspot.com
'----------------------------
Dim arTemp() As Variant
Dim lRet
On Error GoTo Err_Clr
'Default method Uses Open Dialog To Show the Files
lRet = Application.GetOpenFilename
'Select Only Excel Files - One File at A Time
lRet = Application.GetOpenFilename("Excel files (*.xls), *.xls")
If lRet = False Then
MsgBox "Select a File Please!!!"
End If
'Select Multiple Files - Get Multiple Files as Input
' An array can be used to get the multiple excel files selected by user
arTemp = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", MultiSelect:=True)
If UBound(arTemp) = 0 Then
MsgBox "Select a File Please!!!"
End If
Err_Clr:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Excel VBA, GetOpenFilename Method, Show Dialog, , Show Open Dialog Box
Showing posts with label Show Open Dialog Box. Show all posts
Showing posts with label Show Open Dialog Box. Show all posts
Thursday, April 19, 2007
Subscribe to:
Posts (Atom)
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.