ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveCopyAs (https://www.excelbanter.com/excel-programming/290620-savecopyas.html)

Mark Worthington

SaveCopyAs
 
Can anyone please advise me about the correct operation of SaveCopyAs.
I am using it as follows:

MsgBox Application.DisplayAlerts
MsgBox ActiveWorkbook.Path & "\_new\" & ActiveWorkbook.Name
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\_new\" &
ActiveWorkbook.Name

So DisplayAlerts is True, yet I get no warning when the SaveCopyAs
overwrites the existing (pre-saved) file.

Is this by design, or am I missing something here. Coding in a
FileExists check is no problem, but I would have thought that ANY save
operation would give an overwrite warning by default.

Regards,

Mark

Tom Ogilvy

SaveCopyAs
 
If displayalerts is true, then you should get a warning/prompt if you want
to overwrite the file.

--
Regards,
Tom Ogilvy

Mark Worthington wrote in message
om...
Can anyone please advise me about the correct operation of SaveCopyAs.
I am using it as follows:

MsgBox Application.DisplayAlerts
MsgBox ActiveWorkbook.Path & "\_new\" & ActiveWorkbook.Name
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\_new\" &
ActiveWorkbook.Name

So DisplayAlerts is True, yet I get no warning when the SaveCopyAs
overwrites the existing (pre-saved) file.

Is this by design, or am I missing something here. Coding in a
FileExists check is no problem, but I would have thought that ANY save
operation would give an overwrite warning by default.

Regards,

Mark




Bob Phillips[_6_]

SaveCopyAs
 
Mark,

does the _new directory exist before you issue this command?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mark Worthington" wrote in message
om...
Can anyone please advise me about the correct operation of SaveCopyAs.
I am using it as follows:

MsgBox Application.DisplayAlerts
MsgBox ActiveWorkbook.Path & "\_new\" & ActiveWorkbook.Name
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\_new\" &
ActiveWorkbook.Name

So DisplayAlerts is True, yet I get no warning when the SaveCopyAs
overwrites the existing (pre-saved) file.

Is this by design, or am I missing something here. Coding in a
FileExists check is no problem, but I would have thought that ANY save
operation would give an overwrite warning by default.

Regards,

Mark




Tom Ogilvy

SaveCopyAs
 
Sorry, I misread your post (saw SaveAs, rather than SaveCopyAs) - SaveCopyAs
does not give a warning, so you will need to check it yourself. Since it is
designed to be used to create a backup, I assume the philosophy is that the
default behavior would be that there is a previous backup that should be
overwritten.


--
Regards,
Tom Ogilvy


Tom Ogilvy wrote in message
...
If displayalerts is true, then you should get a warning/prompt if you want
to overwrite the file.

--
Regards,
Tom Ogilvy

Mark Worthington wrote in message
om...
Can anyone please advise me about the correct operation of SaveCopyAs.
I am using it as follows:

MsgBox Application.DisplayAlerts
MsgBox ActiveWorkbook.Path & "\_new\" & ActiveWorkbook.Name
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\_new\" &
ActiveWorkbook.Name

So DisplayAlerts is True, yet I get no warning when the SaveCopyAs
overwrites the existing (pre-saved) file.

Is this by design, or am I missing something here. Coding in a
FileExists check is no problem, but I would have thought that ANY save
operation would give an overwrite warning by default.

Regards,

Mark






Mark Worthington[_2_]

SaveCopyAs
 
Tom,

Yes, I guessed the same. Actually, I thought of the designers saying
"what would be a really dumb thing to do, such that its behaviour will
be the opposite to its siblings (Save & SaveAs)" ...!

Oh well, one gets used to unusual Excel characteristics. It is also
strange that this is not really documented (unlike
ActiveWorkbook.CreateBackup) and I couldn't even find this out in such a
tome as JW's Excel 2002 Power Programming with VBA. It seems such a
useful method, too …..

Bob,

Yes, the directory has to be present, as I found out!

Regards, and thanks for your help,

Mark




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 03:54 AM.

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