excel vba browse file

  • Thread starter Thread starter jazzy
  • Start date Start date
J

jazzy

I am trying to find a way to get a command button in excel to brows
through files so you can pick the file you want to open when you clic
on it
 
See Application.GetOpenFilename. E.g.,

Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
If FName = False Then
' user clicked cancel
Else
MsgBox FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thank you for tryng to help me but what if the file u want to open i
not an excel file its an access fil
 
Try

Dim FName As Variant
FName = Application.GetOpenFilename("All files (*.*),*.*")
If FName = False Then
' user clicked cancel
Else
MsgBox FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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