Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,907
- Office Version
- 365
- Platform
- Windows
Hi
Does anyone know how to create a new recordset as an exact copy of an existing pivot cache recordset? I can't access the external data that the pivot table is created from. I would like to either create a new recordset that is an exact copy, or output the entire existing recordset to a text file. I have tried the following:
Application-defined or object-defined error.
I have also tried:
Does anyone know how to create a new recordset as an exact copy of an existing pivot cache recordset? I can't access the external data that the pivot table is created from. I would like to either create a new recordset that is an exact copy, or output the entire existing recordset to a text file. I have tried the following:
Code:
[COLOR=blue]Public[/COLOR] [COLOR=blue]Sub[/COLOR] CloneRecordSet()
[COLOR=blue]Dim[/COLOR] recData [COLOR=blue]As[/COLOR] ADODB.Recordset
[COLOR=blue]Dim[/COLOR] pvc [COLOR=blue]As[/COLOR] PivotCache
[COLOR=blue]Set[/COLOR] pvc = Sheet4.PivotTables(1).PivotCache
[COLOR=blue]Set[/COLOR] recData = pvc.Recordset.Clone(adLockUnspecified) [COLOR=red]'error on this line[/COLOR]
[COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
I have also tried:
Rich (BB code):
Set recData = pvc.Recordset