Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Open a "save as" dialog box using a macro

Status
Not open for further replies.

dutchmen

Materials
Jun 23, 2003
4
What VSB language make it possible to open a "save as" dialog box when running the macro? Also a problem for me is, how to refer the default filename in the "save as" dialog box to a cell contents in the concerned worksheet? Thanks in advance for your help.
 
Replies continue below

Recommended for you

if you use the macro recorder, you'll get the exact syntax for the function. After that, you'll need to insert the variable containing the name you want.

TTFN
 
IRrstuff,

Unfortunately this is not working because I am not able to stop the macro when the save as dialog box is open. My problem is to create a macro that only opens the "save as" dialog box.
 
Now not being to aufait with the problem, but the macros can be worked round.

1.record the macro and go through "save as" procedure
2. insert a file name like XXXXXXXX (something identifiable)
3. once you have seved it and are back in the spreadsheet, stop recording the macro.
4 go into edit macro and delete everything after the command that calls your file xxxxxxxx. transferr the name you want to call your file and close macro.


with some fiddling about this should be able to work.
 
Dutchmen:

Three simple lines of code will do all you ask:

Sub FileSave()
ChDir ("C:\WINDOWS\Desktop\")
MyFileName = Range("A1").Text
Application.Dialogs(xlDialogSaveAs).Show MyFileName
End Sub

This macro takes the text from cell "A1" and inserts it into the "save as" dialog box file name box. The ChDir command just sets the directory location where the saveas dialog box opens.

Good Luck!

jproj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor