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

I am generating a series of workbooks from an access database and before the
code loops to the next record set I am trying to build a pivot table in each
one.

When stepping thru the code fails:

ActiveWorkbook.PivotCaches.Add("SourceType:=xlData base, SourceData:=
qdf.name!R1C1:R91C11").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10


qdf.name is the variable name given to the query from which the workbook is
generated and the name of the worksheet with the data.

I believe the hangup is in how I am trying to pass that variable through to
all the workbooks.

Any help is appreciated

Thanks in advance


--
Jeff C
Live Well .. Be Happy In All You Do
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Pivot Table Code Fails


--
Jeff C
Live Well .. Be Happy In All You Do


"Jeff C" wrote:

I am generating a series of workbooks from an access database and before the
code loops to the next record set I am trying to build a pivot table in each
one.

When stepping thru the code fails:

ActiveWorkbook.PivotCaches.Add("SourceType:=xlData base, SourceData:=
qdf.name!R1C1:R91C11").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10


qdf.name is the variable name given to the query from which the workbook is
generated and the name of the worksheet with the data.

I believe the hangup is in how I am trying to pass that variable through to
all the workbooks.



Still working on the problem:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, strTemp,
"D:\Users\" & strFacName & ".xls"


Set xls = CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("D:\Users\" & strFacName & ".xls").Worksheets(1)

'Set xwkb.worksheets(1).Name = strFacValue

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"worksheets(1)!R1C1:R2000C11").CreatePivotTabl e
TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10


The ActiveWorkbook definition section still fails


Any help is appreciated

Thanks in advance


--
Jeff C
Live Well .. Be Happy In All You Do

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
Pivot Table Wizard Fails to Recognize New Rows of a Named Range Ed K Excel Worksheet Functions 2 January 23rd 08 12:31 AM
Pivot Table Wizard Fails to Recognize New Rows of Database Ed K Excel Discussion (Misc queries) 2 January 21st 08 03:05 PM
Pivot Table Creation Macro fails with Error #5 "Invalid procedure call or argument" [email protected] Excel Programming 1 July 10th 07 08:01 PM
vlookup fails on data from a pivot table Pat Excel Worksheet Functions 3 August 17th 05 09:30 PM
VBA Code for a pivot table to open database and to reference table current page Pete Straman Straman via OfficeKB.com Excel Programming 0 February 21st 05 03:57 AM


All times are GMT +1. The time now is 12:36 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"