Yes, Greg, I think you are right. I'm just not clever enough to code this.
I did the following:
Debug.Print ActiveWorkbook.PivotCaches(i).Connection
Which yielded:
ODBC;DSN=XXX;UID=XXX;DBQ=XXX;ASY=OFF;
My unsucessful attempt at coding is:
ActiveWorkbook.PivotCaches(i).MakeConnection
Connection:="ODBC;DSN=XXX;UID=XXX;PWD=XXX;DBQ=XXX;ASY=OFF;"
I really appreciate any help you can give me...
Cinque, what I did, was turn on the macro recorder and then manually go
through all the steps you normally do to connect. This should produce a
connection string with all your defaults, except the PW. You can then
modify the connection string with your password. HTH
Greg
CinqueTerra - 25 May 2006 00:23 GMT
Thanks, Greg. I had tried the macro recorder early on. For some reason it
did not return the code. I did find this code in VBA help by searching on
connection. And it works!!! Thanks for all your assistance!!!
With ActiveWorkbook.PivotCaches(i)
.Connection = _
"ODBC;DSN=XXX;UID=XXX;PWD=XXX;DBQ=XXX;ASY=OFF;"
.Refresh
End With
> Cinque, what I did, was turn on the macro recorder and then manually go
> through all the steps you normally do to connect. This should produce a
> connection string with all your defaults, except the PW. You can then
> modify the connection string with your password. HTH
>
> Greg