Re: Overwriting an existing Excel workbook



I have re-tested, and you are right about the AlertBeforeOverwriting
not making any difference (as it shouldn't). Actually, on my machine I
*always* got an overwrite prompt from VBA with the test code that I
tried. It works properly from the Interop in C#, I stupidly assumed
that my tinkering with the global flag did that.


Dave Peterson schreef:

From xl2003's help for AlertBeforeOverwriting...

True if Microsoft Excel displays a message before overwriting nonblank cells
during a drag-and-drop editing operation. Read/write Boolean.

That's the setting you can toggle via Tools|Options|Edit tab|under the allow
cell drag and drop box.

I've never seen xl2003 show the warning prompt when I've used
"application.displayalerts = false"

And the Conflictresolution setting has to do with shared workbooks. If the
workbook isn't shared, this won't have any effect.

Also from xl2003's help for the ConflictResolution Property:

Returns or sets the way conflicts are to be resolved whenever a shared workbook
is updated. Read/write XlSaveConflictResolution.

XlSaveConflictResolution can be one of these XlSaveConflictResolution constants.
xlLocalSessionChanges. The local user's changes are always accepted.
xlOtherSessionChanges. The local user's changes are always rejected.
xlUserResolution. A dialog box asks the user to resolve the conflict.


b.engelbrecht@xxxxxxxxx wrote:

In Excel 2003 you need to set this before calling SaveAs:
DisplayAlerts = False
AlertBeforeOverwriting = False

In this Excel version, DisplayAlerts = False does not suppress the
overwrite warning. To make very sure that you are never prompted, it is
recommended that you also use the ConflictResolution parameter of
SaveAs, like this:

ActiveWorkbook.SaveAs Filename:="name to be used",
FileFormat:=xlNormal, ConflictResolution:=xlLocalSessionChanges

Best regards,

Berend

Dave Peterson schreef:

Do the "if yes" suggestion.

Jenni wrote:

Yes in my macro would be great but if that cannot be done I was hoping there
is a way for me to "turn off" that warning temporarily while I run my macro.

"Dave Peterson" wrote:

You mean in your macro?

If yes:

application.displayalerts = false
'your code to do .saveas
application.displayalerts = true

If you mean when you use file|saveas, I don't think so.

Jenni wrote:

When I "save as" and overwrite an existing workbook I get the prompt "are you
sure you want to overwrite" is there any way to not get that prompt? To just
overwrite without warning?

--

Dave Peterson


--

Dave Peterson

--

Dave Peterson

.



Relevant Pages

  • Re: Overwriting an existing Excel workbook
    ... And the Conflictresolution setting has to do with shared workbooks. ... In Excel 2003 you need to set this before calling SaveAs: ... Dave Peterson schreef: ... When I "save as" and overwrite an existing workbook I get the prompt "are you ...
    (microsoft.public.excel.misc)
  • Re: excel object
    ... Thanks for the reply but which one do I use to overwrite an existing file ... without a prompt. ... This script will be scheduled. ... In order to crete an excel object do I have to have excel ...
    (microsoft.public.scripting.vbscript)
  • Re: SaveFileDialog.ShowDialog() returns Cancel when Yes to overwri
    ... I am using the SaveFileDialog out of a *.exe that does not have a GUI ... The workaround I found is to just disable the overwrite prompt ... a bug in your own code that makes the return value looks bad when it is ...
    (microsoft.public.dotnet.languages.vb)
  • Re: SaveAs with Prompt (no overwrite w/o prompt!!)
    ... suggested using the fs object (fileSystem Object) which will work fine. ... Another option is to use the FileSearch from within Word. ... > According to Help, if you use SaveAs, you don't get a prompt to overwrite. ...
    (microsoft.public.word.vba.customization)
  • Re: Great SWT Program
    ... Plus it prompts me whether to overwrite one if I pick ... the odds are 100% that emacs will ask you whether you want ... The prompt looks something like: ... [Bent tacitly admits that his professional needs include an elitist ...
    (comp.lang.java.programmer)