(C) 2009 - 2014 by Mourad Louha · All rights reserved

The Office 2010 VBA Code Compatibility Inspector – OCCI

As mentionned in my previous article, I’m following the excellent blog posts from Gray Knowlton. Gray already presented there the „Microsoft Office 2010 Code Compatibility Inspector – shortly OCCI“, I would like to report about my experiences with this tool. This application is currently at its beta stage, so we can’t expect all will work fine.

First, lets download the application from the Microsoft Download Center and the unpack the contents of the zip archive. I my case, trying to unzip the file to an inexistent folder on my hard disk leads to an error message telling me that the folder can not be created. No matter, I unzipped the archive contents to the folder proposed by OCCI. This works. The we can call the OCCI installer.

OCCI

After clicking in „Next“, you can setup the components to be installed. Please note, that I have also installed Visual Studio 2008 on my computer. So may be the installer will show you more or less options on this page, I did not checked this.

OCCI

The next step allows me to choose a folder where to install the software.

OCCI

The installation the runs without any problems on my computer.

OCCI

The OCCI application are COM Add-Ins for the several Office applications, so after the installation you will not find some new entries in your Windows Programs Menu or somewhere else. However, the first time you are starting an Office application, for example Excel, you may see a dialogue asking you to activate the add-in. Follwing picture shows this windows in German.

OCCI

The add-in is on my computer also available in Office 2007. You can find in the developer ribbon some new entries, both in Ecel 2010 and Excel 2007. I don’t really know if it works on Excel 2003; I didn’t find it there. The following screen shows where you can find the menu entries for the tool on the developer tab. If you can’t see the developer tab, you should activate it first by calling the application options of your Office application.

OCCI

Now it gets exciting. For my first test, I choosed my own developed application „Hide and unhide objects in Excel“ because it contains a module with functions accessing to Excel VBA functions, a class module, a UserForm and a module using some Windows API calls. In addition, the code is not very extensive and should be sufficient for demonstration purposes. The following picture shows a screenshot of the application. When the Excel add-in is started, a UserForms is modeless loaded and the user can hide or unhide the shapes contained in the active sheet by pressing the appropriate buttons. This functionality is available in Excel 2007 and Excel 2010, but not in Excel 2003.

OCCI

The follwing screenshot shows the available modules and some code for calling Windows API functions.

OCCI

Let’s now call the code inspector by clicking on „Inspect VBA Code“ from the developer tab. The inspector presents itself like shown in the screenshot below:

OCCI

The windows allows to select different areas which would be scanned. Please note, that the tool will inspect the currently active workbook. After clicking on „Inspect“, the process starts, as shown in the figure below.

OCCI

When the scan is finished, you should get a little summary.

OCCI

If you then click on „Ok“, you are asked to save your scan in a file in a folder of your choice. The report is stored as a textfile, so you can open it for example with Notepad. Here an excerpt of the scan of my application.

OCCI

As you can see, the report lists possible locations in the code, which can lead to difficulties in Office 2010. In additions you will also find links to other hints and tips from Microsoft. If selected in the start dialogue, the VBA inspector will also insert comments in your code. So you will be able to quickly find the problematic points. By clicking on „Remove Comments“ in the developer tab, you can remove these comments.

OCCI

As I’m curious, I repeated the scans with some modules of a greater own developed application with more than 25,000 lines of code. Ok, the inspector then needs some more time for performing the scan, but I did not encounter any problems.

All in all, I personally find this tool brilliant and I am excited about the next versions. Finally, a few links to interesting articles, and of course the blog from Gray Knowlton.

This article has also been published in German and in English on the following sites:

 

 
Comments

No comments yet.

Leave a Reply