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

automatically save over an existing excel document

Status
Not open for further replies.

hopelessliar

Technical User
Apr 29, 2002
89
GB
Below is my code to automatically update a file when users open this workbook. What I want to know is, can I prevent the dialogue asking whether to replace the existing file and just automatically replace it?

Thanks


Sub Auto_Open()

'Routine to automatically update the reccydata file in the root of users' drives

Workbooks.Open FileName:= _
"M:\PLANNING\Develop\Luc\New Reccy\J&J Reccy\JJreccydata_Master.xls" _
, UpdateLinks:=3
ActiveWorkbook.SaveAs FileName:="C:\JJreccydata.xls", FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
MsgBox ("Data File Updated - Pressing OK will close this workbook")
ActiveWindow.Close

End Sub
 
Set display alerts to false ie

Code:
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\My Documents\book2.xls"
Application.DisplayAlerts = True

;-) If a man says something and there are no women there to hear him, is he still wrong?
 
lucmcconnel,

Try this modification:

Code:
Application.DisplayAlerts = False
Code:
ActiveWorkbook.SaveAs FileName:="C:\JJreccydata.xls", FileFormat:=xlNormal _
        , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
        CreateBackup:=False
Code:
Application.DisplayAlerts = True


HTH
Mike
 
Loomah,

How are you, mate?

Your fingers be quicker than mine!! [wink]


Regards,
Mike
 
Mike
Fine thanks! How about you?

Quiet Xmas tho and football wasn't up to much!
Still unemployed so having a little break before I hit the Evening Standard!:-D

;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Loomah,

I'm good, thanks. Must admit, I'm relieved to have the holidays behind me. Now I can get on with the important business of ignoring New Years resolutions!!

Here's hoping you snag something worthwhile in the employment dept. [thumbsup2]


Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top