![]() |
File dialog box
Hi,
How can I get a file dialog box to come up in my code (or when I press a button) and return the file name that I select? -- Steve R |
File dialog box
Are you trying to find an existing file?
Look at application.getopenfilename in VBA's help. Are you trying to allow the user to specify any file (like to save a workbook): look at application.getsaveasfilename in vba's help. Each of these will return the name chosen--but won't do more with it. You have to do that yourself. dim myFileName as variant 'in case user cancels myfilename = application.getopenfilename if myfilename = false then msgbox "try later" 'cancel exit sub end if msgbox myfilename Steve wrote: Hi, How can I get a file dialog box to come up in my code (or when I press a button) and return the file name that I select? -- Steve R -- Dave Peterson |
File dialog box
Perfect, Thank you
-- Steve R "Dave Peterson" wrote: Are you trying to find an existing file? Look at application.getopenfilename in VBA's help. Are you trying to allow the user to specify any file (like to save a workbook): look at application.getsaveasfilename in vba's help. Each of these will return the name chosen--but won't do more with it. You have to do that yourself. dim myFileName as variant 'in case user cancels myfilename = application.getopenfilename if myfilename = false then msgbox "try later" 'cancel exit sub end if msgbox myfilename Steve wrote: Hi, How can I get a file dialog box to come up in my code (or when I press a button) and return the file name that I select? -- Steve R -- Dave Peterson |
All times are GMT +1. The time now is 02:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com