SaveCopyAs

  • Thread starter Mark Worthington
  • Start date
M

Mark Worthington

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
 
T

Tom Ogilvy

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

Bob Phillips

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)
 
T

Tom Ogilvy

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.
 
M

Mark Worthington

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top