ProjectGuideContent Property Example for Microsoft Project 2002This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The following code sample changes the default content for the Project Guide to the XML file specified by the user. An input box prompts the user for the path and file name for custom Project Guide content, and Microsoft® Project sets the appropriate options in the Interface tab of the Options dialog box. (3 pages)
Note If the user enters an invalid path or file name for the custom Project Guide content, Microsoft Project displays the following message: "Microsoft Project cannot use the XML file path\filename.xml to display the Project Guide content for this project. You can either open this project using the default Project Guide content, or you can retry opening the XML file."
- Microsoft Project Professional 2002 or Microsoft Project Standard 2002
This code example assumes that you are familiar with Microsoft Project and Microsoft Visual Basic® for Applications (VBA), and that you can write or reuse supplementary code as necessary.
To run this code example, you must have Microsoft Project 2002 (either Standard or Professional edition) installed on your computer. You can either paste the code into the Microsoft Visual Basic Editor (VBE) in Microsoft Project or into your VBA project.
You can cut and paste the Microsoft Visual Basic for Applications (VBA) code below.
To create a new macro
- On the Tools menu, point to Macro and click Macros.
- Type a name for your new macro in the Macro name box.
- Select the project where you wish to create the macro in the Macros in box.
- Click Create.
Sub UseCustomProjectGuide() If Projects.Count = 0 Then MsgBox "You must have at least one active project open." Exit Sub End If Dim ProjectGuideURL As String ProjectGuideURL = InputBox$(Prompt:="Enter the path and " _ & "file name of the XML file for custom Project " _ & "Guide content." & Chr(13) _ & "For example, c:\custom.xml") If ProjectGuideURL = Empty Then Exit Sub Else ActiveProject.ProjectGuideUseDefaultContent = False ActiveProject.ProjectGuideContent = ProjectGuideURL MsgBox Prompt:="The custom Project Guide content " _ & "defined in " & ProjectGuideURL & " is " _ & "now in use for the current project." End If End Sub