ObjLibrary references question

E

Ed

Please correct me if my thinking is off:
When I set a reference to an object library, it's saved in the template,
yes? So if I want to distribute a document with a macro that references a
certain object library, I need to create a template for it with the
reference set in that template's VBIDE? And that template then will reside
in the other user's StartUp folder? Did I get them all right?

Ed
 
W

Word Heretic

G'day "Ed" <ed_millis@NO_SPAM.yahoo.com>,

Documents can also contain VBProjects. You can drag your template
magic over, or do it programatically using ActiveDocument.VbProject

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Ed reckoned:
 
E

Ed

Thank you for the reply, Steve. My biggest concern was setting a reference
to a certain object library in the VBE - will that reference move with a
macro in the document? or is it set in my template, and if another user
opens the doc with his template, the reference will be missing and the macro
inoperative?

As for setting the reference programmatically, I did a Google on the
newsgroup, but came up with a lot of "it doesn't work" posts, including a
conversation between you and Howard Kaikow
(http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=eDKEkvBaEHA.3708
%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%2
6selm%3DeDKEkvBaEHA.3708%2540TK2MSFTNGP10.phx.gbl). If there is more info
on a way to detect references and set the necessary ones using a macro, I
would be most grateful for any pointers.

Ed
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Ed > écrivait :
In this message, < Ed > wrote:

|| Thank you for the reply, Steve. My biggest concern was setting a
reference
|| to a certain object library in the VBE - will that reference move with a
|| macro in the document? or is it set in my template, and if another user
|| opens the doc with his template, the reference will be missing and the
macro
|| inoperative?
||

Example:

I have template, called TempA.dot
It contains macros and a reference to library qwerty.olb.

I create a document from TempA and I save it as DocA.doc.
As long as I open DocA on my machine and that TempA.dot is present, all the
macros will run fine, including the references to qwerty.olb.

Now, I send to my colleague DocA.doc.
He opens it. But because he does not have TempA.dot, none of the macros will
be available. So the Reference question becomes moot because the template
is missing, therefore the whole project is unavailable (so the macros and
the references are not available as well).

The same would happen to my DocA.doc on my machine if I were to delete
TempA.dot.

Does this make any sense?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
E

Ed

Thank you, Jean-Guy. If I've gotten this right: I need to create a
template with all the references and macros I need, create a document from
this template with a VB project using these macros as desired, and ship both
document and template to the other user.

One last question, if I may: is it sufficient to just put this new template
in the Templates folder? or does it need to be added through
Tools>>Templates and Addins?

Ed
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Ed > écrivait :
In this message, < Ed > wrote:

|| Thank you, Jean-Guy. If I've gotten this right: I need to create a
|| template with all the references and macros I need, create a document
from
|| this template with a VB project using these macros as desired, and ship
both
|| document and template to the other user.
||
|| One last question, if I may: is it sufficient to just put this new
template
|| in the Templates folder? or does it need to be added through
|| Tools>>Templates and Addins?
||

Yes, it is sufficient.

If you use it as an add-in it means it will be loaded every time Word
starts. This is a global template. Unless you want the code, toolbars,
autotexts, etc, available to all documents, then it is not necessary to
place the template in the Add-in folder.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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