pivot table connection access

  • Thread starter Thread starter vavasoo
  • Start date Start date
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
 
Back
Top