FileSaveAs in a Macro Overwrites Existing Files Without PromptLast reviewed: July 30, 1997Article ID: Q84697 |
The information in this article applies to:
SYMPTOMSIn Microsoft Word for Windows, if you write a macro that uses the FileSaveAs macro command and gives the document the same name as an existing file, Word overwrites the existing file without warning.
CAUSEThere is a documentation error on page 208 of "Using WordBasic" by WexTech Systems and Microsoft. The same error appears in the Microsoft Word version 2.0 for Windows Help menu topic titled "FileSaveAs." The following statement is incorrect:
If a file with the same name already exists, a message appears asking if you want to replace the existing file.This error does not appear in Word version 6.0 Help menu topic titled, "FileSaveAs Statement."
WORKAROUNDThe following message DOES appear if you run the FileSaveAs command by choosing Save As from the File menu and you type a filename that already exists:
Do you want to replace the existing <filename>?If you want this message to appear when you use the FileSaveAs command in a macro, your macro must call the Save As dialog box from the File menu, as shown in the following macro:
Sub MAIN Dim dlg As FileSaveAs GetCurValues dlg N = Dialog(dlg) If N = - 1 Then FileSaveAs dlg.Name End If End SubReference(s): "Using WordBasic," by WexTech Systems and Microsoft, page 208 Kbcategory: kbusage kbmacro KBSubcategory: kbhelp |
Additional query words: docerr doc err 2.0 2.0a word6 7.0 word95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |