IBM Support

SDK Sample to implement Microsoft Office Automation outside VBA with IBM Cognos Go Office

Question & Answer


Question

How to automate the publish method in Cognos Go Office outisde VBA

Answer

You must create wrapper macros in the Microsoft Office document for every API. You can then
call these macros from your code. The module CognosOfficeAutomationExample.bas is an example
of a wrapper macro that you can call from outside VBA.

The following Visual Basic Script opens Microsoft Office Excel, logs on to IBM Cognos 8 from
Microsoft Office, refreshes the content, publish the content to the content store and logs off.


--------------------------------------------------------------------------
--------------------------------------------------------------------------
' Start Excel in batch mode
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.ScreenUpdating = False
objExcel.DisplayAlerts = False

'Open a workbook that has IBM Cognos 8 data in it.
Set objWorkbook = objExcel.Workbooks.Open("C:\test1.xls")

' Call the wrapper macros
objExcel.Run "Logon", "

http://localhost:80/c8v4ga/cgi-bin/cognos.cgi
","admin", "admin1234", "LDAP"
objExcel.Run "RefreshAllData"
objWorkbook.SaveAs("C:\test1.xls")
objExcel.Run "Publish", "
http://localhost:80/c8v4ga/cgi-bin/cognos.cgi
", "C:\test1.xls", "/content/folder[@name='testing']", "anmeofthereport", "Desc", "Tip"
objExcel.Run "Logoff"
objWorkbook.Save
objWorkbook.Close
objExcel.Quit
--------------------------------------------------------------------------
--------------------------------------------------------------------------



For more codes, i would suggest the client to have a look at the following directory
cognos_go_office_installation_direcotry/Automation

-CognosOfficeAutomationExample.bas
-Automate_COI.vbs
-Automate_COI_Excel.vbs
-Automate_COI_PowerPoint.vbs
-Automate_COI_Word.vbs
.
.
.
[{"Product":{"code":"SS9RUJ","label":"Cognos 8 Go! Mobile"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Cognos 8 Go! Office","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.4;8.3","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

More support for:
Cognos 8 Go! Mobile

Software version:
8.4, 8.3

Operating system(s):
Windows

Document number:
136817

Modified date:
14 October 2022

UID

swg21433506