Selecting a file from dialog

  • Thread starter Thread starter Avi
  • Start date Start date
A

Avi

Hello,

Most of the exemple show how to launch from VBA a dialog to open a file from a directory.

Is there a dialog that is used to select the file so i can use its path name in the module, without opening the file?

Regards

Avi
www.avibenita.com
 
Avi,

The following code will display the File Open dialog and return
the selected file name. It doesn't open the file.

Dim FName As Variant
FName = Application.GetOpenFilename()
If FName = False Then
' no file selected
Else
MsgBox "You chose: " & FName
End If

For other methods of selecting just a folder (not a file), see
http://www.cpearson.com/excel/BrowseFolder.htm


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




Hello,

Most of the exemple show how to launch from VBA a dialog to open
a file from a directory.

Is there a dialog that is used to select the file so i can use
its path name in the module, without opening the file?

Regards

Avi
www.avibenita.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