Share via


Exercise 2: Using the Office 2010 Compatibility Inspector Tool

In this exercise you will use the Compatibility Inspector Tool to update VBA and .NET code to Office 2010. First you will inspect a Power Point slide deck using the inspector Office Add-in to identify potential problems and then repair them. Next you will perform the same process on an .NET Add-in using Visual Studio 2010.

Task 1 – Analyze a VBA Application

In this task, you will inspect an existing Power Point deck to check its VBA code for compatibility with Office 2010.

  1. Install the Compatibility Inspector tool using the OCCI-Release.exe installer in the %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility folder
    1. Double click the msi file to start the installer.
    2. On the first page, click Next.
    3. Verify the Add-in for Office and Add-in for Visual Studio are both checked then click Next.

      Figure 8

      Code Compatibility Inspector Install

    4. Leave the install path as default and click Next twice to start the installation
    5. Once the installation is completed, click Close.
  2. Open Demo File.ppt in and verify the Inspection add-in is ready to run
    1. Open Demo File.ppt in %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility\Source\Starter
    2. Right click the ribbon and select Customize the Ribbon
    3. In the PowerPoint Options UI, locate the Developer ribbon in the right hand list and verify its checkbox is checked.

      Figure 9

      Customize the Ribbon

    4. Close the PowerPoint Options dialog by clicking OK
  3. Run the compatibility inspection process on the slide deck
    1. Switch to the Developer tab in the ribbon and click the Inspect VBA Code button

      Figure 10

      Inspect VBA Code

    2. In the Inspect VBA Project dialog, verify all checkboxes are checked and click Inspect

      Figure 11

      VBA Inspection Options

      Note:
      If a warning appears relating to programmatic access to the VBA project follow the instructions to enable access to the object model and repeat the step.
    3. When the process has completed, a summary of the results is displayed

      Figure 12

      VBA Inspection Summary

    4. Click OK on the summary to move on to saving the summary report. Click Save to save at the default location
    5. The complete list of all suggestions is stored in the text file

      Figure 13

      VBA Inspection Details

  4. Review the suggestions made by the compatibility inspector tool
    1. Switch to the Developer tab in the ribbon and click the Visual Basic button
    2. In Microsoft Visual Basic for Applications, open the clsPPTEvents file using the tree view on the left
      Figure 14

      Opening clsPPTEvents

    3. Comments have been added to the code to provide suggestions

      Figure 15

      VBA Inspection Comments

  5. Cleanup the comments added by the inspection tool
    1. Switch to the Developer tab in the ribbon and click the Remove Comments button
    2. Open the VBA code window and verify the inspection comments have been removed

      Figure 16

      VBA Comments Removed

Task 2 – Analyze a Office Addin in Visual Studio 2010

In this task, you will connect the List web part to the InfoPath web part. This connection will allow the InfoPath form to display the details of the customer selected in the List web part.

  1. Open the sample Excel2007AddIn project
    1. Open Visual Studio 2010
    2. The solution located in %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility\Source\Starter\Excel2007AddIn\StarterExcel2007AddIn.sln
  2. Inspect the Office AddIn project
    1. Click Tools -> Inspect VSTO Code to start the inspection process

      Figure 17

      Inspect Visual Studio Add-In

    2. In the Inspect Visual Studio Project dialog, make sure all checkboxes are checked except Backup and click Inspect

      Figure 18

      Visual Studio Inspection Options

    3. When the process is completed, a summary of the inspection is displayed. Click OK when you’re done reviewing it

      Figure 19

      Visual Studio Inspection Summary

    4. Click OK on the summary to move on to saving the summary report. Click Save to save at the default location
    5. The complete list of all suggestions is stored in the text file

      Figure 20

      Visual Studio Inspection Details

  3. Review the changes made by the inspection tool
    1. Using the Solution Explorer, open Ribbon.cs
    2. Locate the DisplayScripts and PrintActiveWorkbook functions and verify they have comments added to identify potential problems

      Figure 21

      Visual Studio Inspection Comments

  4. Cleanup the comments added by the inspection tool
    1. Click Tools -> Remove VSTO Inspector Comments

      Figure 22

      Remove Visual Studio Inspection Comments

    2. In the dialog box, click Yes to start the removal process
    3. Verify the comments in Ribbon.cs have been removed

      Figure 23

      Visual Studio Inspection Comments Removed