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.
- Install the Compatibility Inspector tool using the OCCI-Release.exe installer in the %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility folder
- Double click the msi file to start the installer.
- On the first page, click Next.
Verify the Add-in for Office and Add-in for Visual Studio are both checked then click Next.
Figure 8
Code Compatibility Inspector Install
- Leave the install path as default and click Next twice to start the installation
- Once the installation is completed, click Close.
- Open Demo File.ppt in and verify the Inspection add-in is ready to run
- Open Demo File.ppt in %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility\Source\Starter
- Right click the ribbon and select Customize the Ribbon
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
- Close the PowerPoint Options dialog by clicking OK
- Run the compatibility inspection process on the slide deck
Switch to the Developer tab in the ribbon and click the Inspect VBA Code button
Figure 10
Inspect VBA Code
In the Inspect VBA Project dialog, verify all checkboxes are checked and click Inspect
Figure 11
VBA Inspection Options
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.
When the process has completed, a summary of the results is displayed
Figure 12
VBA Inspection Summary
- Click OK on the summary to move on to saving the summary report. Click Save to save at the default location
The complete list of all suggestions is stored in the text file
Figure 13
VBA Inspection Details
- Review the suggestions made by the compatibility inspector tool
- Switch to the Developer tab in the ribbon and click the Visual Basic button
- In Microsoft Visual Basic for Applications, open the clsPPTEvents file using the tree view on the left
Figure 14
Opening clsPPTEvents
Comments have been added to the code to provide suggestions
Figure 15
VBA Inspection Comments
- Cleanup the comments added by the inspection tool
- Switch to the Developer tab in the ribbon and click the Remove Comments button
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.
- Open the sample Excel2007AddIn project
- Open Visual Studio 2010
- The solution located in %Office2010DeveloperTrainingKitPath%\Labs\AppCompatibility\Source\Starter\Excel2007AddIn\StarterExcel2007AddIn.sln
- Inspect the Office AddIn project
Click Tools -> Inspect VSTO Code to start the inspection process
Figure 17
Inspect Visual Studio Add-In
In the Inspect Visual Studio Project dialog, make sure all checkboxes are checked except Backup and click Inspect
Figure 18
Visual Studio Inspection Options
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
- Click OK on the summary to move on to saving the summary report. Click Save to save at the default location
The complete list of all suggestions is stored in the text file
Figure 20
Visual Studio Inspection Details
- Review the changes made by the inspection tool
- Using the Solution Explorer, open Ribbon.cs
Locate the DisplayScripts and PrintActiveWorkbook functions and verify they have comments added to identify potential problems
Figure 21
Visual Studio Inspection Comments
- Cleanup the comments added by the inspection tool
Click Tools -> Remove VSTO Inspector Comments
Figure 22
Remove Visual Studio Inspection Comments
- In the dialog box, click Yes to start the removal process
Verify the comments in Ribbon.cs have been removed
Figure 23
Visual Studio Inspection Comments Removed