pivot table connection access

V

vavasoo

hi

the following macro gets stuck where show below

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim pc As PivotCache
Dim pt As PivotTable

con.Open "provider=microsoft.jet.oledb.4.0;" & _
"data source=C:\Users\M Varnendra\Desktop\VBA on Excel\Chapter 22\salesdb.mdb"
sql = "select * from sales"

Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
Set pc.Recordset = rs

'''''getting stuck here
Worksheets.Add before:=Sheets(1)
Set pt = ActiveSheet.PivotTables.Add(PivotCache:=pc, _
tabledestination:=Range("a1"))

know about it?

thank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top