Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

macros and autotext from a non normal.dot tamplate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kurt - 14 Nov 2004 14:37 GMT
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
Jean-Guy Marcil - 15 Nov 2004 03:43 GMT
kurt was telling us:
kurt nous racontait que :

> Hello,
>
[quoted text clipped - 11 lines]
>
> 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
'_______________________________________

Signature

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

- 18 Nov 2004 20:02 GMT
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:
[quoted text clipped - 39 lines]
>    Where:=Selection.Range, RichText:=True
>'_______________________________________
Jean-Guy Marcil - 18 Nov 2004 20:19 GMT
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!

Signature

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


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.