Add password to querytable command

G

Guest

How can I reformat following command to add the password, so I don't have to
type password every time I run macro

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=CEFMS;UID=u4rf9rmd;SERVER=cefms.world;",
Destination:=Range("C4"))
.CommandText = Array
 
N

NickHK

Richard,
I find the easiest way to create connection strings is :
- create a new text file somewhere suitable
- rename it "ConnStr.udl"
- double click
- follow the step filling the relevant info
- OK
- Open the file a text editor
- Copy the text

NickHK
 
G

Guest

Brilliant. I would never have though of that in a million years.

However, where do I put this new text into my old ActiveSheet.QueryTables
command?
I tried replacing the part in between the quotes
(i.e. ODBC;DSN=CEFMS;UID=u4rf9rmd;SERVER=cefms.world;)
but get this error:
Compile error: Expected: list separator or )
and it highlights my password. Could this error be tied to the fact that my
password contaings an underscore "_" similar to the symbol for a continuation
line in VBS?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top