Cognos Analytics

 View Only

Problem controling Cognos for Office with VBS script

  • 1.  Problem controling Cognos for Office with VBS script

    Posted 18 days ago
    Edited by Milan Milovanovic 18 days ago

    After I open Excel file, I can log myself to Cognos, by button (1) or by VBA (2). After that, buttons (3) will still be grayed out. I can not refresh my data. I must click on the big blue button (4), and only then buttons (5) will become functional.

    This is also true for VBA procedures. Procedures like below will not work until I click on the big blue button. I can login with VBA, but I can not clear or refresh my data before clicking on the big blue button.

    ClearAllData
    RefreshAllData
    RefreshAllDataAndFormat

    It seems that Cognos for Office add-on is functional only if Excel panel is opened.

    This is not the problem when I use GUI. I have no problem clicking on the big blue button. The problem is that I can not refresh my report with VBS script. When I use VBS script, lines that are calling VBA procedures will quietly fail. There will be nothing in the TraceLog, and there will be no VBA error.

    objExcel.Run "ClearAllData" 
    objExcel.Run "RefreshAllData"
    objExcel.Run "Logoff"

    In VBA there is no command that will simulate "click" on that big blue button.

    Inside of my VBS procedures there are these two lines:

    'Note, you need to do this to fix a bug with Excel's Addin behavior.
    'Ensure that you do this BEFORE you load any workbooks into Excel.
    'In case the work around does not work in some scenarios, continue with execution
    on error resume next
    objExcel.AddIns("CognosOfficeUDF.Connect").Installed = False
    objExcel.AddIns("CognosOfficeUDF.Connect").Installed = True
    on error goto 0
    'Change error handling mode back to not ignoring errors

    I must say that two lines would return an error if "on error resume next" is removed, so these two lines are not helping.

    How to make add-on responsive to my VBS commands? How to make add-on alive without clicking on the big blue button?



    ------------------------------
    Milan Milovanovic
    ------------------------------