Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File Browse Function (Open dialog box for choosing file) b-123 Excel Programming 1 August 25th 05 10:06 PM
open file dialog-select file-import worksheet Divinedar Excel Programming 1 January 16th 04 07:13 PM
Prompt user to select file with default file selected dialog Bruce Cooley Excel Programming 0 September 15th 03 06:43 AM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:19 PM


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"