Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Prompt user to select file with default file selected dialog

Gary,

Use ChDrive and ChDir,

ChDrive "C:\temp"
ChDir "C:\temp"

--

HTH

Bob Phillips

"Gary Gepner" wrote in message
om...
I want to prompt user with a windows dialog from vba and want user to
pick a file, but I want to be able to specify file directory and name.

I looked at GetOpenFilename, preceded by a chdir command, but I am
not able to default to a specific name.

ChDir ActiveWorkbook.Path
GlbGetFileName = Application.GetOpenFilename _
(fileFilter:="Text Files (*.txt),*.txt", _
FilterIndex:=1, _
Title:="Choose a directory and file name to run the Report")
If GlbGetFileName = "False" Then
Close
Exit Sub
End If

I then went back and remembered the GetSaveAsFilename method, might do
what I want. (it doesn't save a file, just displays the list). This
works functionally perfectly, but the only problem is it displays a
Save button.

GlbGetFileName = Application.GetSaveAsFilename _
(InitialFilename:="c:\bcsits\bcsitsout.txt", _
fileFilter:="Text Files (*.txt), *.txt", _
FilterIndex:=1, _
Title:="Choose a directory and file name to run the Report")
If GlbGetFileName = "False" Then
Close
Exit Sub
End If

Any suggestions?

Gary Gepner



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
User replaces existing file with blank during file open sjs Excel Discussion (Misc queries) 3 August 18th 08 06:16 PM
Macro To Open a User selected File Chris Excel Worksheet Functions 2 September 6th 07 08:58 PM
Dialog prompt during opening of file markuss New Users to Excel 1 June 21st 06 11:32 AM
How do I change file/open/"files of type" to default to "all file. How do I changefiles of type default Excel Discussion (Misc queries) 1 April 19th 05 10:45 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 01:38 AM.

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

About Us

"It's about Microsoft Excel"