Set References in code

P

Parsley

Does anyone know how to set a reference in code rather
than clicking <tools - references - etc>?

I have written a program that moves macros between .dot
files (using OrganizerCopy) but some of the macros require
an ADO connection and I cannot work out how to copy
references or set them up in code.

Thankyou in advance for any / all help
Parsley

..
 
C

Cindy M -WordMVP-

Hi Parsley,
Does anyone know how to set a reference in code rather
than clicking <tools - references - etc>?
In involves using the VBExtensibility library (VBE), and
the commands are AddFromFile or AddFromGUID (the latter,
most likely, for an object library such as ADO as opposed
to a template project).

You should manually activate a reference to this library,
then type VBProject into a code window and press F1 to get
into the Help.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
T

Thomas Winter

Parsley said:
Does anyone know how to set a reference in code rather
than clicking <tools - references - etc>?

I have written a program that moves macros between .dot
files (using OrganizerCopy) but some of the macros require
an ADO connection and I cannot work out how to copy
references or set them up in code.

Thankyou in advance for any / all help
Parsley

You want something like:

ActiveDocument.VBProject.References.AddFromGuid
"{B889DE63-CC60-41F4-B66A-5421B19F454C}", 1, 0

I have done exactly this thing, though not with ADO. Let me know if you need
more help.

-Tom
 

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