|
|
excel 2007 macro recorded pivot table
I record a macro in excel 2007 in which i create a pivot table. when i try to
run the macro i get "invalid procedure call or argument". the same process
works fine in excel 2003. If i look at the debug window the "problem code" is
: -ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"JDE Import!R1C1:R3500C37",
Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="Calculations & summary!R4C3",
TableName:="PivotTable7", _
DefaultVersion:=xlPivotTableVersion12
I guess this gives two questions: how can a recorded macro then not work
again? (i have cleared, removed and recreated the destination sheet and all
sorts) and two, what is wrong with the macro itself?
|
|
0
|
|
|
|
Reply
|
Utf
|
4/16/2010 12:33:01 PM |
|
Actually, it is fairly common for a recorded macro to not work "out of the
box"- they often need just a tiny bit of tweaking.
I'm not a big pivot-table automator, and without seeing the rest of the
macro, it is hard to tell what the problem might be- the wrong sheet might be
active, etc.
I'd suggest you post a followup to the Excel.programming newsgroup, and
include all (or at least a larger chunk) of the code that preceeds the line
where it errors out.
HTH,
Keith
"getting old" wrote:
> I record a macro in excel 2007 in which i create a pivot table. when i try to
> run the macro i get "invalid procedure call or argument". the same process
> works fine in excel 2003. If i look at the debug window the "problem code" is
> : -ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
> "JDE Import!R1C1:R3500C37",
> Version:=xlPivotTableVersion12).CreatePivotTable _
> TableDestination:="Calculations & summary!R4C3",
> TableName:="PivotTable7", _
> DefaultVersion:=xlPivotTableVersion12
>
> I guess this gives two questions: how can a recorded macro then not work
> again? (i have cleared, removed and recreated the destination sheet and all
> sorts) and two, what is wrong with the macro itself?
|
|
0
|
|
|
|
Reply
|
Utf
|
4/16/2010 9:09:01 PM
|
|
Hi
The problem is
xlPivotTableVersion12
For XL2003 change to
xlPivotTableVersion11
--
Regards
Roger Govier
getting old wrote:
> I record a macro in excel 2007 in which i create a pivot table. when i try to
> run the macro i get "invalid procedure call or argument". the same process
> works fine in excel 2003. If i look at the debug window the "problem code" is
> : -ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
> "JDE Import!R1C1:R3500C37",
> Version:=xlPivotTableVersion12).CreatePivotTable _
> TableDestination:="Calculations & summary!R4C3",
> TableName:="PivotTable7", _
> DefaultVersion:=xlPivotTableVersion12
>
> I guess this gives two questions: how can a recorded macro then not work
> again? (i have cleared, removed and recreated the destination sheet and all
> sorts) and two, what is wrong with the macro itself?
|
|
0
|
|
|
|
Reply
|
Roger
|
4/19/2010 8:06:52 AM
|
|
|
2 Replies
383 Views
(page loaded in 0.04 seconds)
|
|
|
|
|
|
|
|
|