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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save As Prompt in Excel 3

Status
Not open for further replies.

cghoga

Programmer
Jun 26, 2003
614
US
I have searched the forum, but I cannot find an example of prompting without a filename hardcoded in the VBA.

I tried recording the macro and copying the code, but it made me save to a location before it would allow me to stop the recorder.

How would I prompt to Save As and allow the user to save to the location of their liking?

I feel silly for asking, but this has got me stumped.

Thanks!
 
Sorry Skip,

I tried it and it worked great, but I need it to open the 'Save As' window.

I did some searching and found the GetSaveFileName, but it looks intimidating.

If you can help I would greatly appreciate it.

Thanks!
 



And the REASON you need to open the SaveAs file window is...

Skip,

[glasses] [red][/red]
[tongue]
 
Set NewBook = Workbooks.Add
Do
fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.SaveAs Filename:=fName

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Thanks MrWilson,

This works great, but if I decide to Cancel the save, the Window keeps popping up because fname never gets set to True?

Also, how can I get xls in the Save as Type list and to default to xls. Right now if I click Save it saves without an xls extension.

May I please have your help?
 
What about this ?
Set NewBook = Workbooks.Add
fName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")
If fName <> False Then
NewBook.SaveAs Filename:=fName
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Guess the VBA help example really wants to make sure the user saves ..... lol

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top