ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Saving a copy of excel file in macro but have it auto write (https://www.excelbanter.com/excel-worksheet-functions/136311-saving-copy-excel-file-macro-but-have-auto-write.html)

pano

Saving a copy of excel file in macro but have it auto write
 
I have the below Macro but would like it not to ask the user before
overwriting the file anyway to do this????

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
'
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:="D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub


Pete_UK

Saving a copy of excel file in macro but have it auto write
 
Try:

Application.DisplayAlerts = False

before the code to turn warning messages off, and

Application.DisplayAlerts =True

after the code to turn them back on.

Hope this helps.

Pete

On Mar 27, 4:21 am, "pano" wrote:
I have the below Macro but would like it not to ask the user before
overwriting the file anyway to do this????

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
'
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:="D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub




pano

Saving a copy of excel file in macro but have it auto write
 
On Mar 27, 6:28 pm, "Pete_UK" wrote:
Try:

Application.DisplayAlerts = False

before the code to turn warning messages off, and

Application.DisplayAlerts =True

after the code to turn them back on.

Hope this helps.

Pete

On Mar 27, 4:21 am, "pano" wrote:



I have the below Macro but would like it not to ask the user before
overwriting the file anyway to do this????


Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
'
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:="D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub- Hide quoted text -


- Show quoted text -


Thanks Pete thats the bit I was missing......



Pete_UK

Saving a copy of excel file in macro but have it auto write
 
You're welcome - thanks for feeding back.

Pete

On Mar 27, 12:31 pm, "pano" wrote:

Thanks Pete thats the bit I was missing......





Mike

Saving a copy of excel file in macro but have it auto write
 
This should do it

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
Application.DisplayAlerts = False 'This will turn off the alert
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:= _
"D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True 'This will turn back on the alert
End Sub

"pano" wrote:

I have the below Macro but would like it not to ask the user before
overwriting the file anyway to do this????

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
'
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:="D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub




All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com