WD2001: "Compile Error: Can't Find Project or Library" Error Message When You Quit Word (321449)



The information in this article applies to:

  • Microsoft Word 2001 for Macintosh

This article was previously published under Q321449

SYMPTOMS

When you quit Word, you may receive the following Microsoft Visual Basic error message:
Compile Error:
Can't find project or library
The macro virus protection feature in Word may be turned off, and you cannot turn it back on.

CAUSE

This problem may be the result of a macro virus.

RESOLUTION

Microsoft does not provide software that can detect or remove computer viruses. If you suspect or confirm that your computer is infected with a virus, obtain current antivirus software. For a list of antivirus software manufacturers, click the following article number to see the article in the Microsoft Knowledge Base:

49500 List of Antivirus Software Vendors

To remove the virus, clean Word, and then clean the infected files, follow these steps:
  1. Install an antivirus program. For a long-term solution to macro viruses, install antivirus software that is specifically designed to detect macro viruses. For additional information about antivirus software vendors, including software that can detect and prevent macro viruses, click the article number below to view the article in the Microsoft Knowledge Base:

    49500 List of Antivirus Software Vendors

    Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
  2. Quit Word.
  3. In the Finder, open the hard disk.
  4. Open the System Folder:Extensions folder, and then drag the following files to the Trash:
    • Microsoft Component Library
    • Microsoft Internet Library
    • Microsoft OLE Automation
    • Microsoft OLE Library
    • Microsoft Structured Storage
  5. Drag the following files from the System:Preferences folder to the desktop:
    • Word Settings (9)
    • Embedding Preferences
    • PPC Registration Database
  6. Drag the Normal template to the desktop.

    The Normal template file is typically located in the root of the Microsoft Office 2001:Template folder.
  7. Restart the computer, and then rebuild the desktop.

How to Remove Macros from Your Document

To clean the infected document, remove the macro component from the document by using either of the following methods.

CAUTION: Press and hold down SHIFT when you open a file that may be affected by a macro virus. This prevents Word from running any auto macros; therefore, if a macro virus is present, Word does not load it.

Method 1: Remove the Macro Storage Component

Macros that are contained in your Word document or template are saved in a module. To remove the module from your Word document or template, follow these steps.

NOTE: Removing a module removes the macros that it contains.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
  1. Open the document.

    CAUTION: Press and hold down SHIFT when you open a file that may be affected by a macro virus. This prevents Word from running any auto macros; therefore, if a macro virus is present, Word does not load it.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. In the Project window, expand the document (template) project. The document (template) project will look similar to the following example:

    Project (file name)

    NOTE: If the Project window is not visible, click Project Explorer on the View menu. To expand the document (template) project, click the plus sign to the left of the Project (file name).
  4. Expand the Modules folder.

    NOTE: The modules folder exists only if the document contains a macro.
  5. Click the module. For example, click NewMacros.

    NOTE: The name of the module that is listed may be different in your document (template) project. For example, it may be named Module1.
  6. On the File menu, click Remove Module Name. When you are prompted to export the module before removing it, click No.

    NOTE: If you are not sure whether the module that you are removing contains macros, click Yes, and then export the module as a Basics Files (*.bas).
  7. Repeat steps 5 and 6 for each module that is listed under the Project (file name) Modules folder.
  8. On the File menu, click Close and return to Microsoft Word.
  9. Save and close the Word document (template).

Method 2: Save the Word Document in Rich Text Format (RTF)

  1. Open the document.

    CAUTION: Press and hold down SHIFT when you open a file that may be affected by a macro virus. This prevents Word from running any auto macros; therefore, if a macro virus is present, Word does not load it.
  2. On the File menu, click Save As.
  3. In the Save as type box, click Rich Text Format (*.rtf), and then click Save.

    When you are prompted to confirm saving in RTF, click Yes
  4. On the File menu, click Close.
  5. On the File menu, click Open, and then open the RTF document that you saved in step 3.
  6. On the File menu, click Save As.
  7. In the Save as type box, click Word Document (*.doc), and then click Save.

    If you are saving the file back to its original file name, click Yes when you are prompted to confirm replacing the existing file.
  8. Close the document, and then reopen it.
Word does not save any macros or remaining macro storage components to the new document.

NOTES
  • You can set the Macro Virus Protection option that is designed to notify you if you open a file that contains macros, regardless of what the macros do. (In Word 2001 for Mac, on the Edit menu, click Preferences and then click the General tab. In Word 2001 for Mac , on the Word menu, click Preferences and then click General.) For a permanent solution, you must use antivirus software that is specifically designed to detect and prevent macro viruses.
  • Word does not look for macro viruses or remove any macro viruses from existing documents and templates. It only warns you if the document that you are opening contains macros. You can then open the document and either allow or disallow the macros to run. Do not allow the macros to run unless you are sure that the document contains no macro viruses.
  • You must update third-party antivirus programs frequently for them to remain effective. Contact the vendor for update information.
  • Disinfectant, a freeware antivirus utility for the Macintosh, does not protect against macro viruses. Because Disinfectant will not be updated for future viruses or worms, the current version of Disinfectant, 3.7.1, is the final version.
For additional information about macro viruses, click the article numbers below to view the articles in the Microsoft Knowledge Base:

291824 OFF2001: What to Do If Your Computer Has a Macro Virus

311382 MacOFF: Frequently Asked Questions Macro Security Updates

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Modification Type:MinorLast Reviewed:1/9/2006
Keywords:kberrmsg kbprb KB321449