Hello,

I'm trying to write a macro that inserts an autotext entry
from a template other than the Normal.dot.

In the code, NormalTemplate.AutoTextEntries("cbo").Insert
Where:=Selection.Range, _RichText:=True
when I try to replace Normal with the name of my global
template where the "cbo" autotext is found, I get an error
message.

In a macro,how can I tell Word to look on any other
template, or on all active templates to find autotexts?

Much appreciation!

Kurt

Re: macros and autotext from a non normal.dot tamplate by Jean-Guy

Jean-Guy
Sun Nov 14 21:43:13 CST 2004

kurt was telling us:
kurt nous racontait que :

> Hello,
>
> I'm trying to write a macro that inserts an autotext entry
> from a template other than the Normal.dot.
>
> In the code, NormalTemplate.AutoTextEntries("cbo").Insert
> Where:=Selection.Range, _RichText:=True
> when I try to replace Normal with the name of my global
> template where the "cbo" autotext is found, I get an error
> message.
>
> In a macro,how can I tell Word to look on any other
> template, or on all active templates to find autotexts?
>
> Much appreciation!
>

Normally we use the AttachedTemplate property to insert Autotext form the
template on which the current document is based:

'_______________________________________
Dim MyDoc As Document

Set MyDoc = ActiveDocument

MyDoc.AttachedTemplate.AutoTextEntries("cbo").Insert _
Where:=Selection.Range, RichText:=True
'_______________________________________

If you want absolute control and insert Autotext from any template it can be
done. However, the template must be active (opened, a document based on that
template is opened, it is a global template in the Start-up directory, etc.)

'_______________________________________
Dim MyTemplate As Template

Set MyTemplate = Templates("X:\Template1.dot")
MyTemplate.AutoTextEntries("cbo").Insert _
Where:=Selection.Range, RichText:=True
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: macros and autotext from a non normal.dot tamplate by anonymous

anonymous
Thu Nov 18 14:02:37 CST 2004

Thanks so much Jean-Guy! That worked perfectly.

Are you french, or quebecois perhaps? I speak french and
lived abroad, both in Paris and New Caledonia. I also
worked in Quebec for 8 months, and your name is quite
french sounding.

En tout cas, merci pour tout!

Kurt

>-----Original Message-----
>kurt was telling us:
>kurt nous racontait que :
>
>> Hello,
>>
>> I'm trying to write a macro that inserts an autotext
entry
>> from a template other than the Normal.dot.
>>
>> In the code, NormalTemplate.AutoTextEntries
("cbo").Insert
>> Where:=Selection.Range, _RichText:=True
>> when I try to replace Normal with the name of my global
>> template where the "cbo" autotext is found, I get an
error
>> message.
>>
>> In a macro,how can I tell Word to look on any other
>> template, or on all active templates to find autotexts?
>>
>> Much appreciation!
>>
>
>Normally we use the AttachedTemplate property to insert
Autotext form the
>template on which the current document is based:
>
>'_______________________________________
>Dim MyDoc As Document
>
>Set MyDoc = ActiveDocument
>
>MyDoc.AttachedTemplate.AutoTextEntries("cbo").Insert _
> Where:=Selection.Range, RichText:=True
>'_______________________________________
>
>If you want absolute control and insert Autotext from any
template it can be
>done. However, the template must be active (opened, a
document based on that
>template is opened, it is a global template in the Start-
up directory, etc.)
>
>'_______________________________________
>Dim MyTemplate As Template
>
>Set MyTemplate = Templates("X:\Template1.dot")
>MyTemplate.AutoTextEntries("cbo").Insert _
> Where:=Selection.Range, RichText:=True
>'_______________________________________
>
>--
>Salut!
>_______________________________________
>Jean-Guy Marcil - Word MVP
>jmarcilREMOVE@CAPSsympatico.caTHISTOO
>Word MVP site: http://www.word.mvps.org
>
>
>
>.
>

Re: macros and autotext from a non normal.dot tamplate by Jean-Guy

Jean-Guy
Thu Nov 18 14:19:58 CST 2004

anonymous@discussions.microsoft.com was telling us:
anonymous@discussions.microsoft.com nous racontait que :

> Thanks so much Jean-Guy! That worked perfectly.
>
> Are you french, or quebecois perhaps? I speak french and

The later...

> lived abroad, both in Paris and New Caledonia. I also

Wow, would love to go to New Caledonia... any contracts over there?

> worked in Quebec for 8 months, and your name is quite

Whereabouts?

> french sounding.

Yep, that it is!

> En tout cas, merci pour tout!

De rien!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org