i have excel document several (50+) embedded sql queries refreshed , update counts , query results. need change server , database these queries run , hoping there simpler way manually typing in. have searched through of other questions here unable find matched looking do.
most of connection strings this:
driver=sql server;server=servername;uid=thisisme;trusted_connection=yes;app=microsoft office 2013;wsid=cepc098jjn
what need add also, database believe looks this:
initial catalog=databasename
any guidance on next steps on how update these connection strings appreciated.
perhaps should use text file store values as suggested miguel. in application, load values into dictionary, convenient , easy use. example:
sub test() dim d, key set d = fileload("c:\soft\1.txt") each key in d.keys debug.print ("key = " & key & " value = " & d(key)) next key end sub function fileload(path string) variant dim str, arr, dict open path input #1 set dict = createobject("scripting.dictionary") until eof(1) line input #1, str arr = split(str, ":") dict.add arr(0), arr(1) loop close #1 set fileload = dict end function
text file like: initial catalog:databasename
and replace values in strings...
Comments
Post a Comment