C
CinqueTerra
I have a series of workbooks containing 2 or more Pivot Tables. Each table
refreshes from an external source over an ODBC connection. The user is
prompted for username/password for each table refresh. I'd like to have a
UserForm capture the username/password once and then code VBA to supply it on
each refresh.
I've found this snipet of code (thanks to this forum), but do not know how
to proceed.
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Dsn=myDsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
Any thoughts on how to do this? Thanks in advance!!!
My current code:
For Each sht In ActiveWorkbook.Worksheets
For i = 1 To sht.PivotTables.count
Set pvt = sht.PivotTables(i)
pvt.RefreshTable
Next i
Next sht
refreshes from an external source over an ODBC connection. The user is
prompted for username/password for each table refresh. I'd like to have a
UserForm capture the username/password once and then code VBA to supply it on
each refresh.
I've found this snipet of code (thanks to this forum), but do not know how
to proceed.
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
"Dsn=myDsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
Any thoughts on how to do this? Thanks in advance!!!
My current code:
For Each sht In ActiveWorkbook.Worksheets
For i = 1 To sht.PivotTables.count
Set pvt = sht.PivotTables(i)
pvt.RefreshTable
Next i
Next sht