WD97: WordBasic MacroCopy Command Fails

Last reviewed: March 10, 1998
Article ID: Q170267
The information in this article applies to:
  • Microsoft Word 97 for Windows, Service Release 1 (SR-1)

SYMPTOMS

When you attempt to use a WordBasic.MacroCopy command to copy a macro from any location other than a local template to any location other than a global template, the copy may fail.

The table that follows details how the WordBasic.MacroCopy, WordBasic.Organizer, and Application.OrganizerCopy commands perform in Microsoft Word 97 SR-1.

NOTE: "Global Temp" indicates any template loaded globally (i.e. through Tools/Templates and Add-Ins) other than Normal.

An error will be generated when trying to perform any of the illegal copies. The error message will change depending on the command used and the target.

Programmatic Macro Copy in Word 97 SR-1

Using WordBasic.MacroCopy

Source       Target        Valid  Err  Error Message

Document     Document      Yes
Document     Template      Yes
Document     Normal        Yes
Document     Global Temp   No*    24   Bad Parameter
Template     Document      Yes
Template     Template      Yes
Template     Normal        Yes
Template     Global Temp   No*    24   Bad Parameter
Normal       Document      No     24   Bad Parameter
Normal       Template      No     24   Bad Parameter
Normal       Normal        No     24   Bad Parameter
Normal       Global Temp   No     24   Bad Parameter
Global Temp  Document      No     24   Bad Parameter
Global Temp  Template      No     24   Bad Parameter
Global Temp  Normal        No     24   Bad Parameter
Global Temp  Global Temp   No     24   Bad Parameter

Using WordBasic.Organizer

Source       Target        Valid  Err  Error Message

Document     Document      Yes
Document     Template      Yes
Document     Normal        Yes
Document     Global Temp   No*    1844 The project item cannot be copied
Template     Document      Yes
Template     Template      Yes
Template     Normal        Yes
Template     Global Temp   No*    1844 The project item cannot be copied
Normal       Document      No     102  Command failed
Normal       Template      No     102  Command failed
Normal       Normal        No     102  Command failed
Normal       Global Temp   No     102  Command failed
Global Temp  Document      No     102  Command failed
Global Temp  Template      No     102  Command failed
Global Temp  Normal        No     102  Command failed
Global Temp  Global Temp   No     1844 The project item cannot be copied

Using Application.OrganizerCopy

Source       Target        Valid  Err  Error Message

Document     Document      Yes
Document     Template      Yes
Document     Normal        Yes
Document     Global Temp   No*    5940 The project item cannot be copied
Template     Document      Yes 
Template     Template      Yes 
Template     Normal        Yes 
Template     Global Temp   No*    5940 The project item cannot be copied
Normal       Document      No     4198 Command failed
Normal       Template      No     4198 Command failed
Normal       Normal        No     4198 Command failed
Normal       Global Temp   No     4198 Command failed
Global Temp  Document      No     4198 Command failed
Global Temp  Template      No     4198 Command failed
Global Temp  Normal	   No     4198 Command failed
Global Temp  Global Temp   No     5940 The project item cannot be copied

* Copying from a document or template to a Global Temp WILL WORK if the Global Temp is open in Word for editing.

CAUSE

This functionality is by design in Microsoft Word 97 SR-1, in an effort to reduce the spread of macro viruses. This behavior is different from Microsoft Word 97. In Microsoft Word 97, the command will be executed as expected.

WORKAROUND

Instead of using the WordBasic object to copy macros from one location to another, use the Microsoft Word 97 object model.

For more information about equivalent commands in the Microsoft Word 97 object model, click the Office Assistant, type "What is WordBasic.MacroCopy?," click Search, and then click to view "Visual Basic Equivalents for WordBasic Commands."

NOTE: You must be in the Visual Basic Editor before you click the Office Assistant for help.

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Word Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component

REFERENCES

For more information about macro viruses, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE ID: Q134727
   TITLE: WD: What to Do If You Have a Macro Virus

   ARTICLE ID: Q163932
   TITLE: WD: Frequently Asked Questions About Word Macro Viruses

   ARTICLE ID: Q162198
   TITLE: WD97: Article List: Microsoft Word 97 Word Macro Virus

For more information about macro viruses, click the Office Assistant, type "macro virus," click Search, and then click "Check documents for macros that might contain viruses."


Additional query words: sr1 release1 8.0 8.0
Keywords : kbwordvba winword word8 word97 kbmacro kbusage
Version : WINDOWS:97SR1
Platform : WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 10, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.