Oops, should read...
"Alternatively, you can check if the file exists and if so
prompt the use with your own alert...
Dim vRet
If FileExists("myfile.xlsm") Then
vRet = MsgBox("A file named 'myfile.xlsm' already exists in this
location. Do you want to replace it?", vbYesNo)
If vRet = vbYes Then
Kill "myfile.xlsm" '//delete it before saving
Else
FileCopy "myfile.xlsm", "myfile.xlsm.bak" '//create a backup
End If
...which escapes Excel's intervention entirely. Thus, no need to specify
a value for the 'CreateBackup' arg of the SaveAs method...
ActiveWorkbook.SaveAs Filename:="myfile.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion