Troubleshoot recording and running macros

Microsoft Office Word 2003

check box; use digital signatures; maintain a list of trusted publishers.

ShowWhile recording a macro, I recorded an action I didn't want.

To undo an unwanted action in a macro, you can open the macro in the Visual Basic Editor and remove any unwanted steps.

If you don't want to use the Visual Basic Editor, record the macro again without the unwanted action.

ShowA macro I recorded sometimes produces an error message.

A macro you record may not run properly in every situation. If the macro cannot run, Microsoft Word displays an error message. Some macros depend on certain options or settings in Word. For example, a macro that searches for hidden text won't run properly if hidden text isn't displayed.

ShowI keep getting a warning about macros.

  • The macro you want to run might not be from a trusted source If the security level is set to Medium or High, and you open a file or load an add-in that contains digitally signed macros that are not from a trusted source, you receive a macro warning. If you are sure you trust the macro developer, add the name to the list of trusted sources.

  • The file might contain a macro virus If you don't expect the file to contain a macro, you might have a virus that is adding a macro virus to the file. Check your computer for viruses, and try to get an uninfected copy of the file from the source.

  • The macro might be in a file you downloaded as an HTML page from a Web site and opened as a temporary file If your virus scanner tells you it cleaned out a virus in this file every time you open it, you are removing the virus from the temporary file only, not from the original file on the Web server. Check your computer for viruses, and notify the source about problems with the original file.

  • The file contains legitimate macros If you know these are legitimate and safe macros, you might want to digitally sign those macros and then add your name to the list of trusted sources.

ShowI don't want to be warned about any macros.

To avoid macro warnings, attach a digital signature to each macro project and add that signature to your list of trusted sources. If the macros are already signed, and if you are willing to trust all macros signed with that certificate, add the signer to your list of trusted sources. This will stop macro warnings when your Security setting is set to High or Medium.

A less secure option is to change the security level to Low. If you do use Low, you use Microsoft Word in its least secure setting. Be sure to take the following precautions to minimize your risk of getting a macro virus infection on your computer: run a specialized antivirus software that can check files and add-ins for macro viruses and keep this software up-to-date, and be sure all the macros that you use are from trusted sources.

ShowI don't see a warning when I open a file or load an add-in that contains macros.

  • The security level might be set to Low To receive a warning that a file or add-in contains macros, change the security level to Medium.

  • The security level might be set to High and the macros are not digitally signed To receive a warning that a file or add-in contains macros that have not been digitally signed, change the security level to Medium.

  • You or someone you have designated as a trusted source might have developed the macros If so, the file is opened and macros are enabled. If you no longer trust the macro developer, you can remove the developer from the list of trusted sources.

    To be prompted every time you open a file or load an add-in that contains macros, remove every source from the list of trusted sources.

    To confirm that the macros in the file were signed and to see the name of the source of this file:

    1. On the Tools menu, click Options, and then click the Security tab.

    2. Under Macro security, click Macro Security, and click the Trusted Publishers tab.

ShowI can't edit my macros when my document is open.

If your document is read-only, you can't save editing changes to its macros. If a document is read-only, Microsoft Word adds [Read-Only] to the file name in the title bar.

ShowI can't record a macro when my document is open.

If your document is read-only, you can't save macros you record in that document. If a document is read-only, Microsoft Word adds [Read-Only] to the file name in the title bar.

ShowI can't run a macro when my document is open.

If your document is read-only, you can't save changes that result when you run macros in that document. If a document is read-only, Microsoft Word adds [Read-Only] to the file name in the title bar.

ShowI want to use my WordBasic macros.

Microsoft Office Word 2003 automatically converts the WordBasic macros in a Microsoft Word 6.x or Microsoft Word 95 template to Microsoft Visual Basic for Applications (VBA) the first time you perform any of the following actions:

  • Open the template.
  • Create a new document based on the template.
  • Attach the template to a document by using the Templates and Add-Ins command on the Tools menu.

A message appears on the status bar while the macros are being converted. After the conversion is complete, you must save the template in order to save the converted macros. If you don't, Word converts the macros again the next time you use the template.

Macros stored in a Microsoft Word 97, Microsoft Word 2000, and Microsoft Word 2002 document or template are already in Visual Basic, so they run as designed in Office Word 2003.

Note  Once you have saved a converted WordBasic macro in Office Word 2003, you will not be able run it in Word 6.x or Word 95— even if you convert the template it is stored in back to Word 6.x or Word 95 format.

ShowI want to use my Word 2000 and Word 2002 macros in Office Word 2003.

Macros stored in Microsoft Word 2000 and Word 2002 documents or templates run as designed in Microsoft Office Word 2003— no conversion is required.

Macros stored in Office Word 2003 documents or templates also run as designed in Word 2000 and Word 2002, unless they contain methods and properties that are new in Office Word 2003.

ShowWhen I copied a toolbar, my macros weren't copied.

When you use the Organizer dialog box (on the Tools menu, point to Macro, click Macros, and then click Organizer) to copy a toolbar from another template, Microsoft Word does not copy the macros associated with the toolbar buttons. You must use the Organizer dialog box to copy the macros separately.