Hi KGoyena,
I need to query a SQL Server database from a Word macro. Is this possible?
Yes, it's possible...
Which version of Word are we dealing with? In general terms, if this isn't a
really, really old version, running on an old version of Windows, you'd:
1. Go to Tools/References and set a reference to a Microsoft ActiveX Data
Objects library. Usually, that's referred to by its acronym: ADO
2. Declare ADODB objects in your code for the connection, recordset, etc.
Then write the code to use them.
If you're unfamiliar with ADO and need to learn about details on what kinds
of objects and how to use them, you really should use ADO resources,
documentation, etc. There is a set of "Data" newsgroups on this server, one
is for OLEDB stuff, which is ADO.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail