Pivot refresh
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-10-17 12:47 PM
Hi,
I'm a little bit stuck with pivot refresh in Excel. I did an object in Excel VBO named "Pivot Refresh" with code below:
Dim wb, ws As Object
Dim excel, sheet As Object
wb = GetWorkbook(handle, workbookname)
ws = GetWorksheet(handle, workbookname, worksheetname)
wb.Activate()
ws.Activate()
excel = ws.Application
sheet = excel.ActivateSheet
sheet.PivotTables(pivotname).RefreshTable
This is my last code, unfortunately not working...Check Code returns no mistakes.
After execution the object I get message: "Could not execute code stage because exception thrown by code stage: The given key was not present in the dictionary.
Can you help me with this problem?
4 REPLIES 4
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-10-17 05:50 PM
not a great solution, but one way to do it is to create a RefreshAll macro within the workbook, then use Excel VBO ""Run Macro"".
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-10-17 07:37 PM
I think the error that you have is related to the handle that you use, try to create a new Excel instance and pass its handle to your code.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-10-17 12:09 PM
I am using this code:
dim worksheet as object
worksheet= GetWorksheet(Handle, Workbook_name, Worksheet_name)
worksheet.PivotTables(pivot_name).PivotCache.Refresh
And it works for me.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-11-17 01:15 PM
@Andrzej.Kaczor thank you!!!
![](/skins/images/54F4EFCE64C1A620A51377EF9ADF6C5F/responsive_peak/images/icon_anonymous_message.png)