Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in Excel not updating spreadsheet
I have an embedded macro that runs when a certain spreadsheet is called from
inside access. For the most part the sheet works on certain machines but will not run on all computers. I am kind of baffled why the spreadsheet will not open up and refresh. The code I have under the spreadsheet is: Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) Macro1 Application.WindowState = xlMaximized Wn.WindowState = xlMaximized End Sub Module1 Sub Macro1() ActiveSheet.PivotTables("PivotTable1").RefreshTabl e End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in Excel not updating spreadsheet
If the workbook opens on a sheet that does not have a pivot table, then the
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e will fail. If the table is on Sheet 1 of all workbooks, then you can simply put Sheets(1).Activate in the Macro1 code to ensure it is the active sheet. "Cameron" wrote: I have an embedded macro that runs when a certain spreadsheet is called from inside access. For the most part the sheet works on certain machines but will not run on all computers. I am kind of baffled why the spreadsheet will not open up and refresh. The code I have under the spreadsheet is: Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) Macro1 Application.WindowState = xlMaximized Wn.WindowState = xlMaximized End Sub Module1 Sub Macro1() ActiveSheet.PivotTables("PivotTable1").RefreshTabl e End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in Excel not updating spreadsheet
Yes all the excel spreadsheets have pivot tables on them. But do you think
putting the Sheets clause would be prudent anyway? I built them all to only have one sheet but am trying to determine why the sheet is not updating. Seems kind of odd. "JLGWhiz" wrote: If the workbook opens on a sheet that does not have a pivot table, then the ActiveSheet.PivotTables("PivotTable1").RefreshTabl e will fail. If the table is on Sheet 1 of all workbooks, then you can simply put Sheets(1).Activate in the Macro1 code to ensure it is the active sheet. "Cameron" wrote: I have an embedded macro that runs when a certain spreadsheet is called from inside access. For the most part the sheet works on certain machines but will not run on all computers. I am kind of baffled why the spreadsheet will not open up and refresh. The code I have under the spreadsheet is: Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) Macro1 Application.WindowState = xlMaximized Wn.WindowState = xlMaximized End Sub Module1 Sub Macro1() ActiveSheet.PivotTables("PivotTable1").RefreshTabl e End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in Excel not updating spreadsheet
I don't know. I don't work with Pivot Tables but when code does not execute
as designed, then I start looking for disconnects and that was the first possibility that came to mind. Looking at the help file, I noticed that it refers to a specific range as part of the Pivot Table Refresh method: Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable pvtTable.RefreshTable Could that have an affect? "Cameron" wrote: Yes all the excel spreadsheets have pivot tables on them. But do you think putting the Sheets clause would be prudent anyway? I built them all to only have one sheet but am trying to determine why the sheet is not updating. Seems kind of odd. "JLGWhiz" wrote: If the workbook opens on a sheet that does not have a pivot table, then the ActiveSheet.PivotTables("PivotTable1").RefreshTabl e will fail. If the table is on Sheet 1 of all workbooks, then you can simply put Sheets(1).Activate in the Macro1 code to ensure it is the active sheet. "Cameron" wrote: I have an embedded macro that runs when a certain spreadsheet is called from inside access. For the most part the sheet works on certain machines but will not run on all computers. I am kind of baffled why the spreadsheet will not open up and refresh. The code I have under the spreadsheet is: Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) Macro1 Application.WindowState = xlMaximized Wn.WindowState = xlMaximized End Sub Module1 Sub Macro1() ActiveSheet.PivotTables("PivotTable1").RefreshTabl e End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro in Excel not updating spreadsheet
Thank you, I will give it a try.
Just kind of dreading editing all 30 spreadsheets. :-) "JLGWhiz" wrote: I don't know. I don't work with Pivot Tables but when code does not execute as designed, then I start looking for disconnects and that was the first possibility that came to mind. Looking at the help file, I noticed that it refers to a specific range as part of the Pivot Table Refresh method: Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable pvtTable.RefreshTable Could that have an affect? "Cameron" wrote: Yes all the excel spreadsheets have pivot tables on them. But do you think putting the Sheets clause would be prudent anyway? I built them all to only have one sheet but am trying to determine why the sheet is not updating. Seems kind of odd. "JLGWhiz" wrote: If the workbook opens on a sheet that does not have a pivot table, then the ActiveSheet.PivotTables("PivotTable1").RefreshTabl e will fail. If the table is on Sheet 1 of all workbooks, then you can simply put Sheets(1).Activate in the Macro1 code to ensure it is the active sheet. "Cameron" wrote: I have an embedded macro that runs when a certain spreadsheet is called from inside access. For the most part the sheet works on certain machines but will not run on all computers. I am kind of baffled why the spreadsheet will not open up and refresh. The code I have under the spreadsheet is: Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) Macro1 Application.WindowState = xlMaximized Wn.WindowState = xlMaximized End Sub Module1 Sub Macro1() ActiveSheet.PivotTables("PivotTable1").RefreshTabl e End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Updating Excel Spreadsheet | Excel Discussion (Misc queries) | |||
Updating graphs in Excel using a macro | Excel Discussion (Misc queries) | |||
Automatically updating data from another excel spreadsheet | Excel Worksheet Functions | |||
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? | Excel Discussion (Misc queries) | |||
updating invoice number on excel spreadsheet | Excel Worksheet Functions |