Microsoft KB Archive/255028

= PRJ: Macro Warning, Missing Macros, or Cannot Edit Macro in a Project Saved in 98 Format =

Article ID: 255028

Article Last Modified on 1/27/2007

-

APPLIES TO


 * Microsoft Project 2000 Standard Edition
 * Microsoft Project 98 Standard Edition

-



This article was previously published under Q255028



SYMPTOMS
In Microsoft Project, when you open a project that was saved in the Microsoft Project 98 file format from Microsoft Project 2000, you may see the following behavior.

Symptom 1
You receive one of the following messages, even though you did not create any macros in the project.

In Microsoft Project 98
The project you are opening contains macros.

Some macros may contain viruses that could be harmful to your computer.

If you are sure this project is from a trusted source, click 'Enable Macros'. If you are not sure and want to prevent any macros from running, click 'Disable Macros'.

In Microsoft Project 2000
path\name.mpp contains macros.

Macros may contain viruses. It is always safe to disable macros, but if the macros are legitimate, you might lose some functionality.

Symptom 2
When you open the project in either Microsoft Project 98 or Microsoft Project 2000, one or more macros that were saved in the project may not be listed in the Macros dialog box. If macros saved in the project are listed, you cannot run the macros or open the Visual Basic Editor to edit the macros.

NOTE: In Microsoft Project 2000, when you open the project or when you try to open the Visual Basic Editor to edit a macro in the project, you also receive the following message:

Microsoft Visual Basic

Error accessing file. Network connection may have been lost.

Symptom 3
When you open the project in either Microsoft Project 98 or Microsoft Project 2000, and you try to create or record a new macro in the project, either nothing happens, or you receive the following message:

"name" is not a valid macro name.

A macro name must begin with a letter and can contain letters, numbers, and the underscore character. It cannot contain spaces or be a word that Microsoft Project reserves as a keyword.



Cause for Symptom 1
To ensure that macros are transferred properly, when Microsoft Project 2000 saves a project in the Microsoft Project 98 format, it adds the following Visual Basic for Applications (VBA) statement to the project's Project_Open event: ThisProject.VBProject.Description = ThisProject.VBProject.Description The statement includes the following explanatory comment: 'While saving your file to Microsoft Project 98 format, Microsoft Project 2000 added this line to ensure that your VBA macros are loaded properly When you open the project in Microsoft Project 98, this statement causes Microsoft Project 98 to save the project's Visual Basic project (VBProject) using the version of VBA that is included with Microsoft Project 98.

If built-in macro virus protection is enabled when you open the project in Microsoft Project 98 or Microsoft Project 2000, you receive the macro virus warning described in the "Symptoms" section. This is because the project now contains the macro code that Microsoft Project 2000 added.

Cause for Symptom 2 and Symptom 3
Symptoms 2 and 3 may occur when you do the following:
 * 1) In Microsoft Project 2000, you create one or more macros in a project.
 * 2) You save the project in the Microsoft Project 98 file format.
 * 3) In Microsoft Project 98, the Macro virus protection check box is selected (checked). (To locate this option, click Options on the Tools menu, and then click the General tab.)
 * 4) When you open the project in Microsoft Project 98, you click Disable Macros when you are prompted.
 * 5) While you have the project open in Microsoft Project 98, you do either or both of the following:
 * 6) * You start the Visual Basic Editor, but you do not edit any of the macros contained in the VBProject object for the project.
 * 7) * You run a macro that is contained in any open project or in the global template.
 * 8) You save the project in Microsoft Project 98.
 * 9) You open the project again, in either Microsoft Project 98 or Microsoft Project 2000.

This behavior occurs because if you click Disable Macros when you open the project in Microsoft Project 98, the statement that Microsoft Project 2000 added to the Project_Open event (as described in the "Cause for Symptom 1" section) cannot run.

If you then run any macro, or you open the Visual Basic Editor without editing a macro, Microsoft Project 98 initializes the project's Visual Basic project (VBProject object), but does not properly save the VBProject object using the Microsoft Project 98 version of VBA. This results in the problems described for Symptom 2 and Symptom 3.

If you click Enable Macros, the Project_Open procedure runs, and Microsoft Project 98 will correctly save the VBProject object.



WORKAROUND
To work around the problems described under "Symptom 2" and "Symptom 3," whenever you open a project in Microsoft Project 98 that was saved from Microsoft Project 2000, use either of the following methods:  Click Enable Macros when you are prompted.

-or-  Open the Visual Basic Editor and modify at least one macro contained in the VBProject object for the project. By doing this, you force Microsoft Project 98 to correctly save the VBProject object.

If you do not need to make any revisions to the macro code, you can add a comment line to the macro. For example, add the following line to any macro contained in the project: ' comment to avoid losing macros in this project 

To work around these symptoms after they have occurred, use one of the methods below, as appropriate for your situation.

Method 1: If You Can Create New Macros in the Project
If macros that were saved with the project are no longer listed in the Macros dialog box, but you are able to create new macros in the project, there is no direct workaround to recover the missing macros. You need to either copy the macros from a backup copy of the project, or re-create them.

Method 2: If You Cannot Create New Macros in the Project
If you cannot create new macros or open the Visual Basic Editor in the project, you need to re-create the project file to recover the VBProject object for the project. To re-create the project file without having to reenter the project data, follow these steps:

NOTE: Unless you no longer intend to use the Microsoft Project 98 file format for this project, you should perform the following steps in Microsoft Project 98, to maintain consistency in the project format.  In Microsoft Project 98, open the project that you need to re-create. (In the steps that follow, this project is referred to as "Project1.mpp.") On the Project menu, click Project Information. Make a note of whether Project1.mpp is scheduled from the project start date or the project finish date, along with the corresponding start date or finish date. In the Project Information dialog box, click Cancel.</li> On the File menu, click New.</li> If you see the Project Information dialog box, click OK to accept the defaults.</li> On the File menu, click Save. Save the new project with a name that is different than the project that you are re-creating. (In the steps that follow, the new project is referred to as "Project2.mpp.")</li> In Project2.mpp, click Project Information on the Project menu. In the Project Information dialog box, make the following changes: <ul> If Project1.mpp is scheduled from the project start date, change the Start date setting to the same start date as Project1.mpp.</li> If Project1.mpp is scheduled from the project finish date, in the Schedule from list, click Project Finish Date, and then change the Finish date setting to the same project finish date as Project1.mpp.</li></ul> </li> In the Project Information dialog box, click OK.NOTE: If Project1.mpp contains customized information such as customized base calendars, views, or tables, follow steps 9 through 12 to open the Microsoft Project Organizer and copy the customized information into the new project. Otherwise, skip to step 13.

</li> On the Tools menu, click Organizer.</li> In the Organizer dialog box, on the left side, in the Views available in list, click Project1.mpp.

NOTE: At this point you should see Project1.mpp listed on the left side of the Organizer dialog box, and Project2.mpp listed on the right side.</li> For each of the tabs in the Organizer dialog box, follow these steps:  Click the tab (for example, click the Views tab).

NOTE: If there are Task and Resource options available on the tab, the Task option is selected by default. After you follow steps b and c for the Task option, click Resource, and then repeat steps b and c for the Resource option.</li> For each item listed under Project1.mpp, select the item, and then click Copy.</li> If you are prompted whether to replace an item that already exists in Project2.mpp, click Yes.</li></ol> </li> In the Organizer dialog box, click Close.</li> On the File menu, click Save.</li> <li>On the Window menu, click Project1.mpp.</li> <li>In the Project1.mpp window, click Resource Sheet on the View menu.</li> <li>Click the Select All button (the blank button at the upper-left corner of the Resource Sheet table).</li> <li>On the Edit menu, click Copy Resource.</li> <li>On the Window menu, click Project2.mpp.</li> <li>In the Project2.mpp window, click Resource Sheet on the View menu.</li> <li>On the Edit menu, click Paste.</li> <li>On the Window menu, click Project1.mpp.</li> <li>In the Project1.mpp window, click Gantt Chart on the View menu.</li> <li>Click the Select All button (the blank button at the upper-left corner of the Gantt Chart table).</li> <li>On the Edit menu, click Copy.</li> <li>On the Window menu, click Project2.mpp.</li> <li>In the Project2.mpp window, click Gantt Chart on the View menu.</li> <li>On the Edit menu, click Paste.</li> <li>On the File menu, click Save.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed this to be a problem in Microsoft Project 98.

<div class="references_section">