I have code to get the connection string on a pivot table called PivotTable1.
The strange thing is that the connection strings gets truncated. It only
happens to the connection string that has something like
"DriverId=25;Exclusive=0;FIL=MS
Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeo" <trucation occured here>
Now I havent tried to see if the connection still worked (if I piece it back
to an array)....
-- code--
Sub Get_PT_DbConnection()
Dim oPivotTable As PivotTable
Dim sPvTSrcData As String
Dim i As Long
Set oPivotTable = ActiveSheet.PivotTables("PivotTable1")
oPivotTable.PivotCache.Refresh
For i = LBound(oPivotTable.SourceData) To
UBound(oPivotTable.SourceData)
sPvTSrcData = sPvTSrcData & oPivotTable.SourceData(i)
' Change database connection string
Debug.Print i & " : " & oPivotTable.SourceData(i) & vbCr
Next i
Debug.Print "Sourcedata:" & sPvTSrcData
End Sub
Bookmarks