Open File Dialog from macro?

  • Thread starter Thread starter BBB
  • Start date Start date
B

BBB

Boss wants me to write him a macro that allows him to go select a file then
write the logic to take that file and run some logic. I've been searching
.... I found a FileSearch object but that allows me to find a file - I want
the user to see a File Open dialog and select the file. Is that possible?
If so, can someone point me towards how to do that?

BBB
 
Hi
you may use the GetOpenfileName method. e.g.
Sub test_fileopen()
Dim filename
filename = Application.GetOpenFilename
If filename <> False Then
Workbooks.Open (filename)
MsgBox "File: " & filemame & "is open"
' add your code here
else
exit sub
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top