Setting up for the API

Before you can use the IBM Cognos automation API, you need to add a reference, which connects to IBM Cognos automation. You need to open the Visual Basic Editor, add a reference to IBM Cognos automation, and then access the IBM Cognos automation API.

Adjusting the Trust Center settings

Some settings in the Microsoft Excel Trust Center may need to be adjusted in order to use the IBM Cognos automation API.

Procedure

  1. Open a new Microsoft Excel workbook.
  2. Click File > Options > Trust Center > Trust Center Settings... > Macro Settings.
  3. Select Enable all macros and enable Trust access to the VBA project object model.
    Trust Center options window
  4. Click OK

Results

Your Trust Center settings are now optimized for the IBM Cognos automation API.
Note: Remain on the Options dialog as you'll need it for the next step.

Opening the Visual Basic Editor

IBM Cognos automation and the IBM Cognos automation API functions are called by using macros in VBA. The following steps show you how you can open the Visual Basic Editor and start by using VBA macros.

Procedure

  1. From the Options dialog box, click Customize Ribbon.
  2. If it is not already, select the check box for the Developer tab, in the Main Tabs pane.
    Microsoft Excel Options window
  3. Click OK.
    A new tab titled DEVELOPER is shown in the Microsoft Excel ribbon.
  4. Click DEVELOPER > Visual Basics.
    Developer tab

Results

The Visual Basic Editor opens.

Adding a reference to IBM Cognos automation and accessing the IBM Cognos automation API

Now that you have the Visual Basic Editor open, you can establish a reference to IBM Cognos automation and access the IBM Cognos automation API.

Procedure

  1. Right-click VBAProject and then click Import File....
    VBAProject menu
  2. Browse to the IBM Planning Analytics for Microsoft Excel installation directory.
  3. Download these macro files.
    Download macro files
  4. Highlight CognosOfficeAutomationExample.bas and click Open.
    Import API
  5. Repeat steps 1-3.
  6. Highlight CognosOfficeMessageSuppressor.cls and click Open.
  7. Close the Visual Basic Editor.
  8. Save the workbook as an Excel Macro-Enabled Template.

What to do next

Add IBM Cognos automation API functions to automate your tasks.