xlDialogSave as...Possible to change path??


Posted by Ron on June 25, 2001 7:05 AM

I'm using VBA code with a button as show below to bring up the save as dialog box for the user. Is it possible to put in a "default" path and name of my choice?
Application.Dialogs(xlDialogSaveAs).Show

Thanks for and advice.

Posted by Joe Was on June 25, 2001 7:35 AM

This is the code to pull the SaveAs user box.

Sub MySave()
'This saves by displaying the SaveAs user box.
'This is keyed to the Ctrl-s hot key in macro-options.
'By Joe Was, 6-12-2001

Dim MyFileName As String
MyFileName = Application.GetSaveAsFilename
If MyFileName = "False" Then Exit Sub
ActiveWorkbook.SaveAs MyFileName
End Sub

By default it should pull the current directory and drive?

You could "Set" the file name with ("filename") as object. JSW

Posted by Joe Was on June 25, 2001 7:44 AM

This names the save path.

Sub mySaveName()
'This saves to a preset path and filename.

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileName:="C:\Path\filename.xls", FileFormat _
:=xlXLS, CreateBackup:=False
Application.Displayalerts=True
End Sub



Posted by A.R. on June 25, 2001 10:52 AM

Save As and designated directory

How do you have the Save As User box and a designated directory(path) show up?