F
Fid
Using Excel 2003:
The following code works correctly:
Sub Build_Pivot_Cache
Dim CurrWkbk as Workbook
Set CurrWkbk = Activeworkbook.Name
CurrWkbk.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=
_
"CombinedData!Database").CreatePivotTable TableDestination:= _
"InvoicePivot!R2C1", TableName:="Invoice_Pivot_Table", _
DefaultVersion:=xlPivotTableVersion10
End Sub
The following code gives me Run time error '438' - Object doesn't
support this property of method on the pivotcaches.add line.
Sub Build_Pivot_Cache
Dim CurrWkbk As Workbook
Set CurrWkbk = ActiveWorkbook
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:= _
"CombinedData!Database").CreatePivotTable TableDestination:= _
"[" & CurrWkbk & "]InvoicePivot!R2C1",
TableName:="Invoice_Pivot_Table", _
DefaultVersion:=xlPivotTableVersion10
End Sub
Why does it do this when i try to fully qualify the SourceData?
the only difference in the above is that i am setting CurrWkbk =
Activeworkbook and calling that instead
The following code works correctly:
Sub Build_Pivot_Cache
Dim CurrWkbk as Workbook
Set CurrWkbk = Activeworkbook.Name
CurrWkbk.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=
_
"CombinedData!Database").CreatePivotTable TableDestination:= _
"InvoicePivot!R2C1", TableName:="Invoice_Pivot_Table", _
DefaultVersion:=xlPivotTableVersion10
End Sub
The following code gives me Run time error '438' - Object doesn't
support this property of method on the pivotcaches.add line.
Sub Build_Pivot_Cache
Dim CurrWkbk As Workbook
Set CurrWkbk = ActiveWorkbook
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:= _
"CombinedData!Database").CreatePivotTable TableDestination:= _
"[" & CurrWkbk & "]InvoicePivot!R2C1",
TableName:="Invoice_Pivot_Table", _
DefaultVersion:=xlPivotTableVersion10
End Sub
Why does it do this when i try to fully qualify the SourceData?
the only difference in the above is that i am setting CurrWkbk =
Activeworkbook and calling that instead