Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling SaveAs Dialog Box 2

Status
Not open for further replies.

OzzieOwl

Technical User
Dec 13, 2001
45
0
0
GB
Help

I am using the following code

Application.Dialogs(xlDialogSaveAs).Show

To give the user an option of where to save an excel workbook, however I need to be able to change the default filename, and if possible stop the user from changing it.

Any help greatly appreciated

[noevil]
 
Hi.

I'm not exactly sure what you are trying to achieve since you say you want to give the user an option but also want to prevent the user from changing it.

To suggest a filename + location use the following form:

Code:
Application.Dialogs(xlDialogSaveAs).Show "C:\DefaultDirectory\SuggestedFilename.xls"

To suggest only a location w/o the filename, supply just the path portion of the string:

Code:
Application.Dialogs(xlDialogSaveAs).Show "C:\DefaultDirectory\"

Of course, if you present a SaveAs dialog, you give the user to opportunity to make changes.


Regards,
Mike
 
Thanks Mike,

The restriction was a long shot anyway.

But the prompting filename bit works perfectly.

Cheers

Ozzie
 
Mike:

Great post. I've got a tangential quetion if you don't mind...

I'd like to pass the value of a Word merge field to the Save As dialog box. ie: {mergefield1} becomes the recommended file name:

C:\DefaultDirectory\whateverwasinmergefield1.doc

I know that may be a doozy of a question, but thought I'd ask.

Thanks.
Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top