Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Code Problem

I am trying to click on a command button in a worksheet that will refresh
pivot tables and ODBC connections throughout my workbook. The code seems to
work well to refresh the pivot tables, but once it hits the ODBC data it
errors out.

Can someone help me with my code?

Sheets("Sheet1").PivotTables("PivotTable1").Refres hTable
Sheets("Sheet2").PivotTables("PivotTable1").Refres hTable
Sheets("Sheet3").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Sheet4").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
--
Drew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default Code Problem

Drew wrote:
I am trying to click on a command button in a worksheet that will refresh
pivot tables and ODBC connections throughout my workbook. The code seems to
work well to refresh the pivot tables, but once it hits the ODBC data it
errors out.

Can someone help me with my code?

Sheets("Sheet1").PivotTables("PivotTable1").Refres hTable
Sheets("Sheet2").PivotTables("PivotTable1").Refres hTable
Sheets("Sheet3").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Sheet4").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False


Maybe this will work better for you. Works equally well for pivot tables
and ODBC sources.

Sub RefreshAllPivotTables_n_Such()
ActiveWorkbook.RefreshAll
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
Problem with code (error code 9) Vince Excel Programming 3 October 12th 09 04:16 PM
Problem with code jln via OfficeKB.com Excel Programming 2 November 9th 06 01:40 PM
code problem scrabtree[_2_] Excel Programming 0 September 16th 04 03:48 PM
Code Problem Todd Huttenstine Excel Programming 3 April 16th 04 09:25 PM
problem with code gareth Excel Programming 1 December 5th 03 03:24 PM


All times are GMT +1. The time now is 11:54 PM.

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"