Word 2007 Use buildingblocks from other templates

P

PeterHS

L.s,

I have a .dotm file with macro's, buidingblocks, changes in the UI, etc. I
placed this in the startup folder from word. When i start word all is
availible and works fine.
I placed it not in Normal.dotm fot each user, this is a read-only file wich
all users use so its easy to maintain.

I recorded a macro to place a buidingblock in the header. It says:
activedocument.atachedtemplate.buildingblocks("name")....

But when I run the macro from the UI I get a error.

I could replace atachedtemplate with something like temlates("name"). But I
like to keep the macro simple and without fixed filenames.

Is there a way to let the macro look in all the open templates (like it
works when I look for a buildingblock "by hand"), without programming all
sorts of loops. Something like "all-templates", "open-templates",
"active-templates"

Thanks

Peter
 
S

Stefan Blom

MVP Jean-Guy Marcil has suggested the following:

***************************
As long as it [the template containing the AutoText entry] is indeed in the
Startup folder and that the AutoText names from that template are unique,
you can use:

Dim rngAutoText As Range
Const strAutoTextName As String = "AutoText_Entry_Name"


Set rngAutoText = Selection.Range


With rngAutoText
'In case selection is not an insertion point...
.Collapse wdCollapseStart
.InsertAfter strAutoTextName
.InsertAutoText
End With
***************************

(from the "Inserting AutoText Entries from another Template" thread in this
newsgroup).
 

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