You could pass the File name to a variable.
Then make the dialog box = the variable.
You need to have TextBox1 somewhere on the form. I created a "browse" button and attached this sub to the button click event. This lets you capture the file name for use later in your application. After this you can call a sub with the Open dialog in it to actually open a file. The drawback is that I have never been able to assign a default path this way in office 2k and always have to browse from My Computer.
Private Sub GetFilename()
'This Initiates the Browse Window
Application.DefaultFilePath = ("C:\Test")
FN = Application.GetOpenFilename(FileFilter:="(Excel Workbooks(*.xls),*.xls", Title:="Open File")
If FN <> False Then
'Display the Full Path in the Text Box'
TextBox1_Change
ElseIf FN <> True Then
MsgBox "No File Selected"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.