Save using a Macro

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I have a macro set up to save a worksheet. I always save
it in the same place with the same file name.
What I would like is for the macro to overwrite the file
and then close Excel without prompting.
Sub Backlog()
'
' Backlog Macro
' Macro recorded 07/11/2003 by HFRUPN
'

'
ChDir "G:\Crushing Shedules\Backlog"
ActiveWorkbook.SaveAs Filename:="G:\Crushing
Shedules\Backlog\BACKLOG.xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub
Can this be done?

Regards
Nick
 
Hi
try
Sub Backlog()
'
' Backlog Macro
' Macro recorded 07/11/2003 by HFRUPN
'

'
ChDir "G:\Crushing Shedules\Backlog"
application.displayalerts = false
ActiveWorkbook.SaveAs Filename:="G:\Crushing
Shedules\Backlog\BACKLOG.xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
application.displayalerts = True
End Sub
 
Nick,

If you really want to close Excel, then use

Application.Quit

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thank you for you help.
The Quit command works well but unfortunately I can’t get
the save to work. I get the message “A filenamed ----
Already exists in this location. Do you want to replace
it.” Yes, No or Cancel.
I would like it to save without prompting

Regards
Nick
 
Frank gave the code for that, precede the Save with

application.displayalerts = false

and reset after with

application.displayalerts = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Success!
Thank you both very much. I have been pondering this for
some time.
I really appreciate your help.

Nick
 
Back
Top