Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Excel Spreadsheet joesw Excel Discussion (Misc queries) 1 April 9th 10 10:11 PM
Updating graphs in Excel using a macro Angela R Excel Discussion (Misc queries) 2 July 3rd 07 02:19 PM
Automatically updating data from another excel spreadsheet Gary c Excel Worksheet Functions 1 November 20th 05 02:41 PM
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? oil_driller Excel Discussion (Misc queries) 1 February 8th 05 09:34 AM
updating invoice number on excel spreadsheet beave Excel Worksheet Functions 3 December 26th 04 03:01 PM


All times are GMT +1. The time now is 12:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"