Adding a reference to a different .DOT

R

Rick Charnes

I'm trying to get the hang of this: in Word 2003 I need to link template
A to Template B so template A has all of Template B's macros. Looking
in the VBA Editor at the earlier Word 2000 version that has this link, I
see that the Template A Project contains a folder entitled 'References',
with an item branching off that entitled 'Reference to MYTEMPLATE.DOT'.
How do I add that reference in the Word 2003 version? Thanks.
 
D

Default User

AddIns.Add FileName:="Z:\data\MyTemplates\MyTemplate.dot", _
Install:=True

Krgrds,
Perry
 
D

Default User

Depends when you need the macro's
If you need the the foreign macro's to be instantly availble, use the
AutoExec() routine
to host the previously forwarded line of code.
This way the foreign AddIn will be loaded when yr Master AddIn loads.
Other scenario:
If you want the foreign macro's to be available when new documents based on
yr master template are created, use the
Document_New() routine in the master template to kick in the foreign addin.

Krgrds,
Perry
 
T

Tony Jollans

You add that reference in Word 2003 the same way you added it in Word 2000.

You go to Tools > References and check the box for Template B. But note that
if no use is made of anything in Template B, the reference may not stick.
 
R

Rick Charnes

Thanks. Someone else set it up in Word 2000 -- this is all new to me.
I choose Tools > Reference but then I'm not sure what to check for my
Template B. There already is a 'Reference' folder with a Reference
object but it's a reference to itself! I need to change it to reference
template B instead, which I see is loaded as a separate project -- just
not referenced by that Template A object. Thanks for the help.
 
T

Tony Jollans

When you look at the Project Explorer in the VBE, each project/document
appears as ...

ProjectName (DocumentName)

- unless both are the same in which case it appears simply as

ProjectName

The ProjectNames are what appear in the References List - and all projects
in open documents and templates appear pretty close to the top of the list.
If you have many documents open it's quite possible that there are duplicate
names ("Project" is the default name) but select any of them and the path
and name will be displayed below the listbox so you can identify each
uniquely. To create a reference, check the checkbox beside the appropriate
name. I would imagine that, if you've previously had a reference set, the
default has been changed and you actually have a unique name anyway.

I don't know how you can create a reference to itself - but you should be
able to remove it by unchecking the appropriate box - unless it's some kind
of corruption.
 
R

Rick Charnes

Thanks very much for this. I open TEMP1.DOT and see two top-level
objects in the VBE Project Explorer:
- Normal
- TemplateProject (TEMP1)
I click on Tools > References and don't see any item named
TemplateProject. I then also open TEMP2.DOT which is the template I
want to link to. I go to the VBE editor where I now see a third top-
level object:
- TemplateProject (TEMP2)

In the Project Editor I then select TemplateProject(TEMP1) and choose
Tools > References. I now see a checkbox item below 'Normal' called
'TemplateProject' and at the bottom of the dialog I see that its
Location is [pathname]\TEMP2. I figure I'm on the right track, so I
check it and click OK. It seems to load fine but then I get an error:
"Name conflicts with existing module, project, or object library."

What could I be doing wrong?

(btw, I see that I only get that strange reference to itself if I open
the doc from Windows Explorer rather than from Word directly; this seems
to happen for any template.)
 
T

Tony Jollans

Your trouble is that you have two objects both called TemplateProject. I
don't see how there could have previously been a reference set up with that
being the case, but ...

In the Project Explorer right click on TemplateProject(TEMP2) and select
TemplateProject Properties. This will give you a dialog where you can change
the name from TemplateProject to something unique of your choice. You should
then be able to add a reference to the new name.

I think when you are 'opening from Windows Explorer' what you are probably
doing is creating a new document based on the template rather than opening
the template itself and that new document correctly has a reference to the
template on which it is based. This is what happens if you double click on
the icon rather than right clicking and selecting Open.

--
Enjoy,
Tony


Rick Charnes said:
Thanks very much for this. I open TEMP1.DOT and see two top-level
objects in the VBE Project Explorer:
- Normal
- TemplateProject (TEMP1)
I click on Tools > References and don't see any item named
TemplateProject. I then also open TEMP2.DOT which is the template I
want to link to. I go to the VBE editor where I now see a third top-
level object:
- TemplateProject (TEMP2)

In the Project Editor I then select TemplateProject(TEMP1) and choose
Tools > References. I now see a checkbox item below 'Normal' called
'TemplateProject' and at the bottom of the dialog I see that its
Location is [pathname]\TEMP2. I figure I'm on the right track, so I
check it and click OK. It seems to load fine but then I get an error:
"Name conflicts with existing module, project, or object library."

What could I be doing wrong?

(btw, I see that I only get that strange reference to itself if I open
the doc from Windows Explorer rather than from Word directly; this seems
to happen for any template.)


"Tony Jollans" <My said:
When you look at the Project Explorer in the VBE, each project/document
appears as ...

ProjectName (DocumentName)

- unless both are the same in which case it appears simply as

ProjectName

The ProjectNames are what appear in the References List - and all projects
in open documents and templates appear pretty close to the top of the list.
If you have many documents open it's quite possible that there are duplicate
names ("Project" is the default name) but select any of them and the path
and name will be displayed below the listbox so you can identify each
uniquely. To create a reference, check the checkbox beside the appropriate
name. I would imagine that, if you've previously had a reference set, the
default has been changed and you actually have a unique name anyway.

I don't know how you can create a reference to itself - but you should be
able to remove it by unchecking the appropriate box - unless it's some kind
of corruption.

--
Enjoy,
Tony


Word
2000. note
that link,
I
 
R

Rick Charnes

Thanks. Hoo-boy, I've got a lot of learning to do. I renamed
TemplateProject(TEMP2) project to TestProJ(TEMP2), and I also renamed
TEMP1 to something else just to be sure. Then I did Tools > References,
checked TESTPROJ and clicked OK, thinking that I'd successfully brought
in the reference. Instead, it added a new project -- 'TemplateProject
(TEMP2)' even though I'd already opened that. Furthermore, the
reference object attached to TEMP1 is 'Reference to ~WRC3683.tmp!

Still doing something wrong...

Appreciate all your help.
 
T

Tony Jollans

Wow! I've never seen anything like that. I've just had a quick play and
couldn't reproduce it - a complete guess but are you, perhaps, working with
recovered templates? I'll have to try a few things and get back to you on
this one.
 

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