Utility Spotlight: The Compatibility Question

Lance Whitney

For those of you considering a migration to the new Microsoft Office suite, the upgrade path should prove less painful than the move to Office 2007. The XML-based file format introduced in Office 2007 remains unchanged. The ribbon-based UI is the same and even offers greater flexibility. However, the most feared aspect of any upgrade is compatibility.

Though basic documents may migrate smoothly, how can you be sure all the macros, code and other functionality hidden within more complex documents will survive the leap to Office 2010? That being the case, the most important addition to the new suite is a free utility that can help you find potential compatibility issues in Visual Basic for Applications (VBA) code when upgrading to Office 2010.

The Microsoft Office 2010 Code Compatibility Inspector can examine existing VBA macros and code from prior versions of Office to determine if they’ll work correctly in Office 2010. The tool will scan an existing document in the 2010 versions of Microsoft Office Word, Microsoft Office Excel or Microsoft Office PowerPoint, and alert you to any incompatible code that it discovers. Specifically, it compares older code in your existing documents against the new Office 2010 Object Model by looking for any VBA properties and methods that have changed.

You have the option of using the tool within Office 2010 or within Visual Studio 2008. In Office 2010, simply open the document you wish to scan, and the Compatibility Inspector does the rest.

Download the Office 2010 Code Compatibility Inspector from its page at the Microsoft Download Center. If you’re going to use it with Office 2010, you’ll need to install it on a PC that’s already running the beta of the new Office. Run the EXE file Office14CompatInspector.exe, which will extract an HTML readme file and the SetupOCCI.msi. Then run the MSI file to launch the utility’s setup wizard where you can choose to install it for Office 2010, Visual Studio or both.

All About Office

For the sake of simplicity, I’m going to cover just the process for running the utility in Office 2010. If you choose that option, there are a few initial steps you’ll need to take.

First, display the Developer ribbon in your Office 2010 application as follows:

  • Open Office 2010 Word, Excel or PowerPoint.
  • Click on the File tab and then select Options.
  • Click Customize Ribbon.
  • Under “Customize the Ribbon” on the right side of the window, select Main tabs, and then select the Developer checkbox. Click OK to return to the application’s main window.

Second, you need to enable access to the VBA code as follows:

  • Within the Office 2010 app, click on the File tab and then select Options.
  • Click on Trust Center and then click on Trust Center Settings.
  • Click on Macro Settings and then select the “Trust access to the VBA project object mode” checkbox.
  • Click OK twice to close out of the dialog boxes.

Repeat both processes for each Office 2010 app in which you want to run the Code Compatibility Inspector­—Word, Excel and PowerPoint. To run the Code Compatibility Inspector:

  • Open the document you wish to check.
  • Click on the Developer tab.
  • From the Developer ribbon, click on the button to Inspect VBA Project.

The Microsoft Office 2010 Code Compatibility Inspector dialog window offers four options from which to choose when prompted to inspect VBA code for Word, Excel or PowerPoint

Figure 1 The Microsoft Office 2010 Code Compatibility Inspector dialog window offers four options from which to choose when prompted to inspect VBA code for Word, Excel or PowerPoint.

As you can see in Figure 1, you’ll have four options: Inspect Visual Basic for Application Projects, Inspect Declare statements, Add comments and Detailed Report. The first option—Inspect Visual Basic for Application Projects—will show you any items in the Office Object Model that were changed or removed, so you’ll want to keep that checked. You’ll only need the second option—Inspect Declare statements—if you’re running Office 2010 or potentially 64-bit Office 2010 on any computer. You can leave that checked or not, depending on your environment.

You’ll want to keep the third and fourth options checked to see comments next to any flagged code and to get a detailed report. Once you’ve made your choices, click the Inspect button. The Inspector will then examine the VBA code in your document. After the scan is finished, you’ll see a summary window with the following details of the scan (as shown in Figure 2):

  • Total lines scanned: How many lines of VBA code were scanned
  • Total items found: How many problematic items were found, including changed or deprecated items
  • Deprecated items: How many specific deprecated items were found, meaning items that have been removed from or are no longer supported in the Office Object Model
  • Changed items: How many items use a command whose syntax has changed
  • Redesigned items: How many items have code with the same syntax, but certain design or UI changes that could result in problems
  • Declare statements: How many Windows API statements were found that have been updated for 64-bit — this only appears if you check the Inspect Declare statements option before running the scan

The Microsoft Office 2010 Code Compatibility Inspector Summary Window

Figure 2 The Microsoft Office 2010 Code Compatibility Inspector Summary Window

If the Code Compatibility Inspector finds any incompatibilities, it’s up to you or your developers to debug the code and resolve any issues. By enabling the “Add comments” option before you run the scan, you can at least follow the utility’s clues to narrow down the source of any problems. Comments may also contain a URL to a Web page that can further help you fix incompatibilities.

Microsoft recently announced it would launch the Office 2010 suite for the business world on May 12. It will then be available to the general public in June, so the upgrade decisions will be coming soon. The Code Compatibility Inspector can check documents from the past several versions of Microsoft Office, including Office 2003, Office XP, Office 2000 and Office 97. You can install it on virtually any currently supported flavor of Windows, from Windows 2000 to Windows 7. Find out more about the Code Compatibility Inspector by following the Related Content links.

Lance Whitney* is a writer, IT consultant and software trainer. He’s spent countless hours tweaking Windows workstations and servers. Originally a journalist, he took a blind leap into the IT world in the early ’90s.*