Page 1 of 1

RefreshSheet macro is refreshing the whole book

Posted: Thu Oct 20, 2022 3:48 pm
by antcharwill
Hi there,

I've been experimenting with refreshing PAx data using VBA and I was pointed to this:

Code: Select all

Sub RefreshSheet()

    Application.COMAddIns("CognosOffice12.Connect").Object.AutomationServer.Application("COR", "1.1").RefreshSheet

End Sub
But it's refreshing every sheet in the book, rather than just the active sheet as per the PAx documentation.

Any help appreciated!

Re: RefreshSheet macro is refreshing the whole book

Posted: Mon Nov 14, 2022 3:20 pm
by antcharwill
After further investigation, this might be something to do with the 'Rebuild Sheet' function and not with the RefreshSheet macro. When I click 'Rebuild Sheet' I see the same behaviour: every worksheet is recalculated. This also seems to happen whenever I run any Cognos Office Automation functions.

I have a new workbook with two sheets both containing dynamic reports from different cubes. I change the parameters of both, then run this macro

Code: Select all

Sub test23()
    Reporting.DynamicReports.GetAt(Application.ActiveSheet.Name).Item(0).Refresh
End Sub
And both sheets are recalculated. Formulas are set to 'Manual' so it shouldn't be automatically recalculating things.