#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Savecopyas without password Ray Clark[_2_] Excel Discussion (Misc queries) 9 July 3rd 08 12:50 AM
SaveCopyAs with a twist Rookie 1st class Excel Discussion (Misc queries) 5 January 21st 07 12:33 AM
SaveCopyAs macro Baddad007 Excel Programming 1 December 31st 03 12:26 AM
SaveCopyAs - Userform disappears mohsinb[_2_] Excel Programming 1 November 6th 03 04:02 PM


All times are GMT +1. The time now is 05:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"