View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Allen Tim Allen is offline
external usenet poster
 
Posts: 2
Default Excel VBA & ODBC Data Sources

I've built an excel application that I need to share with many people
within the company, problem is almost none of them have the
non-standard data source defined on their PC, and, seeing as this uses
a service account to access a SQL Server, it would be better that they
not have this data source defined in case they need to access that
server using their own user id... Here is my connection string in VBA:

ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=aProduction SQLServer -
9;UID=*ServiceAccount*;PWD=*ServiceAccountPasswd*; APP=Microsoft Office
XP;WSID=SYS9962;DATABASE=QDB;Network=DBMSSOCN" _
, Destination:=Range("A1"))

This connection string includes the username and password used for the
connection, it does not include the hostname of the sql server, but
instead, the datasouce name, that is what i'm interested in changing...
Is there any chance I can bypass ODBC when connecting to SQL Server
from excel? or anyway i can, from within VBA, create and drop data
sources on the fly?

Thanks for your time,

-Tim