Hi Everyone,

I have meet a problem with this Error Message:
Run Time Error '1004':
Application defined or object defined error

Below is the part where coding goes wrong:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:= _
ActiveWorkbook.Connections("TestTable"), Version:=xlPivotTableVersion12 _
).CreatePivotTable TableDestination:="Sheet1!R1C1", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion12

I am having the connection named TestTable.odc in my pc. This code is auto generated by Macro and I didn't change any thing on it. I wonder what is wrong with this code. Could anyone please help me? Any reply will be appreciated.

Regards,
Benard