This documentation is archived and is not being maintained.

How to: Update Deployed Office Documents That Use Managed Code Extensions (2003 System)

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Microsoft Office 2003

For more information, see Features Available by Application and Project Type.

If a solution document, template, or workbook has been deployed to each end user and the solution assembly is in a network location, the document cannot easily be updated automatically. However, you can use the procedures outlined in this topic to provide automatic notification to end users that the current Office document is outdated, and that they must get a newer version.

The basic steps are:

  1. Create a new Microsoft Office Word 2003 or Microsoft Office Excel 2003 application project based on the document that has been updated. The assembly from this project will be used to provide notification to users that they must get the updated document.

  2. Move the assembly that is currently in use to a new location, and put the notification assembly in the original location.

  3. Point the updated document to the new project assembly location.

If you do not want to completely prevent users from working with the outdated solution, you can call the notification using the Startup event of your existing solution. This reminds users to update every time they open the document.

To create a new project based on an updated document

  1. Make the required revisions to a copy of the existing document, template, or workbook.

  2. In Visual Studio, create a new Word or Excel application project of the same type as your existing solution.

    You will use the assembly in this project as a notification assembly, to replace the project assembly that the outdated Office document points to.

  3. In the Visual Studio Tools for Office Project Wizard, select Copy an existing document.

  4. Next to the Path to the existing document box, click Browse and navigate to the updated document.

  5. Select the document, and then click Open.

  6. Click Finish to create the project based on the updated document.

To create a notification assembly

  1. In the Startup method of the new assembly (the notification assembly), write code to show a message box that contains the information that the user needs to get the updated document. The following code shows an example.

    System.Windows.Forms.MessageBox.Show("This document has been updated. "
        + "Please download a new version from the following location: "
        + @"\\ServerName\FolderName");
  2. Change the output name for the notification assembly by using the project properties so that it has the same name as the project assembly used in your solution. Ensure that the notification assembly has the necessary evidence to be trusted by your deployed solution, such as the correct certificate.

To replace the project assembly with the notification assembly

  1. Copy the project assembly that your solution uses to a new location, and grant it trust at the new location. For more information, see How to: Grant Permissions to Folders and Assemblies (2003 System).

  2. Put the updated Office document in the new location, and copy the deployment and application manifests to the new location.

  3. Edit the new application manifest so that it points to the new deployment manifest and assembly. For more information, see Application Manifests for Office Solutions (2003 System).

  4. Increase the version of the application manifest.

  5. Edit the new deployment manifest so that it points to the new application manifest. For more information, see Deployment Manifests for Office Solutions (2003 System).

  6. Increase the version of the new deployment manifest.

  7. Update the application manifest that is embedded in the document to point to the new deployment manifest location. For more information, see How to: Change the Path to the Deployment Manifest Programmatically (2003 System).

    Now the updated document and the assembly that it points to are ready to be used, as soon as the end users know where to get the updated document.

  8. Deploy the notification assembly to the old assembly location and remove the project assembly. The next time a user opens the outdated Office document, the notification assembly runs, and the user sees the message box that contains information about how to get the latest document version.