LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Changing data source passwords in workbook ?

MikeN wrote:
It appears that you should just be able to update the data
source object (dsn) and all worksheets using it should be
updated. It doesn't seem to work that way. Once the
Workbook is saved, even if you delete the Data Source it
still connects using the old connection information.


Yes, I agree.
In my opinion the potential value of ODBC DSNs has been wasted by a bad
decision to store full connection information with the querytable.

One way around it would be to have the querytables remade each time you
open the workbook, using the DSN, along the lines of.

Sub Auto_Open()
Dim QT As QueryTable
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
For Each QT In WS.QueryTables
QT.Connection = "ODBC;DSN=MyDatabase" ' + any params needed
QT.Refresh BackgroundQuery:=False
Next
Next
End Sub


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Source Data in a Formula akimballsmith Excel Discussion (Misc queries) 2 September 16th 08 07:26 PM
Changing Data Source nathan_savidge Excel Worksheet Functions 1 July 17th 08 05:53 PM
Changing data source in a pivot John R Excel Discussion (Misc queries) 4 October 18th 07 08:09 PM
Changing query data source TonyL Excel Discussion (Misc queries) 1 July 4th 07 04:44 PM
Changing Data Source Driver S Taylor Excel Programming 1 October 15th 03 03:04 PM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"