on 03-30-2021 3:45 PM
Hi
Is it possible to refresh and EPM report without activating or selecting a sheet?? I've always been told it's not good practice to select or activate a sheet when writing VBA.
Example - Current method
Dim api As Object
api = Application.COMAddIns("FPMXLClient.Connect").Object
Sheet1.activiate
api.Refresh
Example - What I'd like to use
Dim api As Object
api = Application.COMAddIns("FPMXLClient.Connect").Object
Sheet1.api.Refresh
Sorry, but there is no API that will refresh some particular sheet without activating it.
"I've always been told it's not good practice to select or activate a sheet when writing VBA." - wrong idea!
You can always store current active sheet in some variable, then activate sheet to be refreshed, then activate sheet saved in variable.
Dim wshCurrent as Worksheet
Set wshCurrent = ThisWorkbook.ActiveSheet 'store current active sheet
ThisWorkbook.Worksheets("SheetWithReportName").Activate
api.RefreshActiveSheet
wshCurrent.Activate 'restore active sheet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
9 | |
9 | |
7 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.