Before_Save event

Q

quartz

I am using Office 2003 on Windows XP.

I want to use a Before_Save event that:

Forces the "Save As" dialog box to open to "C:\" with the contents of the
variable sFileName as the default file name.

Can someone please show me example code on how to work the arguments in the
Before_Save event to do this?

Thanks much.
 
J

Jim Thomlinson

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
On Error GoTo ErrorHandler
Application.EnableEvents = False
Cancel = True
Application.Dialogs(xlDialogSaveAs).Show "C:\This.xls"

ErrorHandler:
Application.EnableEvents = True
End Sub
 
Q

quartz

Jim,

Thanks again. Your solution works, except it does not change the default to
"C". The file name is there, but the path is not changed...how can I modify?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top