Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
PivotTable and connection string
With Excel 2003, I'm trying to replace connection string and make query dynamic but am getting "strange" errors. This is what I have: Private Sub refreshData(dFrom As Date, dTo As Date) Dim pt As PivotTable Dim pc As PivotCache Set pt = Sheet1.PivotTables(1) Set pc = ActiveWorkbook.PivotCaches(pt.CacheIndex) pc.Connection = "SQLOLEDB.1;User ID=sa;Initial Catalog=QuantumPlan;Data Source=myServer" pc.CommandText = "select .... '" pt.PivotCache.Refresh End Sub I'm getting 1004 error on pc.Connection line. Anyone has any idea why and how to get around it? Thanks a lot. lc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use a connection string? | Excel Discussion (Misc queries) | |||
Excel 2007 - The connection for this PivotTable has been deleted | Excel Discussion (Misc queries) | |||
Can't get connection string right | Excel Programming | |||
Can't get connection string right | Excel Programming | |||
What is the connection string ? | Excel Programming |