PowerPoint: How to Debug a PowerPoint Add-in?

PowerPoint - Tips and Tricks
Microsoft PowerPointLeave a Comment on PowerPoint: How to Debug a PowerPoint Add-in?

PowerPoint: How to Debug a PowerPoint Add-in?

In this article we will show you how to debug a standard PowerPoint add-in. There are two kinds of add-ins available for Microsoft PowerPoint:

  1. PowerPoint Add-in Macro (.ppam)
  2. COM add-in

In this article we will explain how you can debug a standard .ppam add-in for PowerPoint. This kind of add-in is written in Visual Basic for Application (VBA), and can be debugged through the built-in code editor in Microsoft PowerPoint. If you enable a .ppam add-in in PowerPoint, and then open the VBA code editor (Alt+F11), you will not be able to view the underlying source code. We will show you have to display the source code.

COM add-ins, which are not covered in this article, can be written in almost any programming language. To learn more about how to develop and debug a COM add-in, please have a look at “Office solutions development overview (VSTO)“. There you will learn how to create add-ins for Microsoft Office using Visual Studio.

The standard way to create a new PowerPoint add-in is to first create a Macro-enabled PowerPoint presentation (.pptm), edit the VBA code, and then save the new Add-in as the special .ppam file format. When the .ppam file has been created, it is not possible to revert back to the original PowerPoint file format. So, always make sure that you store the original macro-enabled file somewhere safe in case you would like to modify the add-in at a later time.

In case you have lost the original .ppam file, or need to debug a 3rd-party add-in you can follow the steps below to view the underlying source code. Just keep in mind that if you try this with a proprietary add-in, it will most likely be protected by a password. The code will not be visible and editable unless you have the original password.

To enable debugging of add-ins in PowerPoint you first need to change or add a setting in the Windows Registry. The Windows Registry is a database which contains the configuration of most applications on your PC, so be careful not to delete or accidentally edit any other settings. It is highly recommended to make a backup of the Windows Registry before you make any changes.

Now, do the following to enable debugging of a standard PowerPoint add-in:

1. Close PowerPoint

When PowerPoint is closed all settings loaded during start-up will be written back to the Windows Registry. So, if any registry values are changed while PowerPoint is still open, they will be overwritten when the application closes. Make sure that you exit all running instances of PowerPoint before you proceed with the next step.

2. Modify the Windows Registry to debug a PowerPoint add-in

To edit the Windows Registry, you can use the Registry Editor application that is available on all Windows PCs.

Click on Start and type in “Registry Editor” in the search field.

Run the Registry Editor as administrator.
Run the Registry Editor as administrator.

Press “Run as administrator” to start the application. If you just press “Open”, or click on the icon, the application will start in normal user mode. You will then not be able to make- and save any changes.

When the Registry Editor opens in administrator mode, navigate to the following location in the left tree menu:

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\PowerPoint\Options

You can also copy (Ctrl+C) and paste (Ctrl+V) the full registry path in the top text box.

This will open the options for Microsoft PowerPoint 365 (version 16.0). If you use a different version of PowerPoint, you will need to replace “16.0” with the correct version. In our example screenshot below, you can also see the nodes for Microsoft Office 11.0, 12.0 and 15.0.

Options for Microsoft PowerPoint

On the right hand side you should find a key named “DebugAddins” with the value 0x00000001 (1). The value “1” (hexadecimal: 0x00000001) means “true”, i.e. debugging of add-ins has been enabled. If the key does not exist, you need to create it. We will now show you how to do it.

To create the “DebugAddins” registry key, please do the following:

Right-click in the right window and select New > DWORD (32-bit) Value in the popup menu.

Add new registry key.
Add new registry key.

DWORD (32-bit) value means that it is an integer value of 4 bytes, i.e. it can store values up to ±2147483648. In our case we will only store the value 1 (true). To disable debugging of Add-ins, specify the value 0 (false).

When the new registry has been added, change the name to “DebugAddins“. To change the value, double-click on the new key. The following dialog is then displayed:

Add the DebugAddins registry key with value equal to 1.
Add the “DebugAddins” registry key with a value equal to 1.

Specify the value 1 in the Value data field. The registry value can be specified as both Hexadecimal and Decimal. The value 1 is the same in both cases, so no need to change to the decimal system.

When done press OK.

You have now enabled debugging of .ppam add-ins in Microsoft PowerPoint. Now, start PowerPoint and make sure that the add-in you would like to debug has been enabled. When PowerPoint is open, do a extra check to verify that the value of the registry key DebugAddins still is set to 1. Sometimes PowerPoint behaves in unexpected ways, and resets the value to 0, i.e. debugging is disabled.

3. View the Source Code of the PowerPoint add-in

To open the VBA code editor, press Alt+F11 on your keyboard, or click the Visual Basic button on the Developer tab.

Open the Visual Basic editor in PowerPoint.
Open the Visual Basic editor in PowerPoint.

The Developer tab might not be visible in PowerPoint and must be enabled by pressing File > Options > Customize Ribbon. Then select Developer in the right Main Tabs section.

When the VBA editor is displayed, you can now find a node for each Add-in in the left project browser, in addition to the code of any open presentations. If the code has been protected by a password, you will not be able to view the code.

View the source of a password protected PowerPoint Add-in.

In the sample screenshot above we have displayed the source code of the Coragi Change Proofing Language Add-in. The code is protected by a password and cannot be edited.

When the source code is available, you can create break points like in any other Visual Basic code.

Related

Ulf Emsoy has long working experience in project management, software development and supply chain management.

Leave a Reply

Your email address will not be published.

Back To Top


Subscribe to our newsletter