ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a file from dialog (https://www.excelbanter.com/excel-programming/344277-selecting-file-dialog.html)

avi

Selecting a file from dialog
 
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

Chip Pearson

Selecting a file from dialog
 
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




"Avi" wrote in message
...
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




All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com