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 2006

Tip: Looking for answers? Try searching our database.

Accesing Autotext

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PPL - 04 Nov 2006 22:13 GMT
Hi,
I'm having dificulty finding a VBA command or script that will let me access
an Auto text  entry in a template that is NOT attached to the current
document. Is it possible to do this?

TIA

Philip
Jonathan West - 04 Nov 2006 23:19 GMT
> Hi,
> I'm having dificulty finding a VBA command or script that will let me
> access an Auto text  entry in a template that is NOT attached to the
> current document. Is it possible to do this?

yes, if the template is open as an add-in. All add-ins are members of the
Templates collection, and you can extract Autotext from any template that is
a member of the Templates collection

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Greg Maxey - 04 Nov 2006 23:24 GMT
Phillip,

Yes it is possible if the template is identified as a global template/AddIn.

Let's say you have a template named Test.dot with an AutoText entry defined
as "gofish"

In my case templates are stored in "E:\My Documents\Word\Template so yo will
need to change the code accordingly:

Sub ScratchMacro()
Dim oAI As AddIn
Dim oRng As Range
Dim oTemplate As Template
Dim bAvailable As Boolean
Set oRng = Selection.Range
bAvailable = False
'Lets say your Addin is called "Test.Dot"
'Determine if the template is available as an AddIn
For Each oAI In AddIns
 If oAI.Name = "Test.dot" Then
   bAvailable = True
   'Load it if not already loaded
   If oAI.Installed = False Then oAI.Installed = True
   Exit For
 End If
Next
'If not available then add it to the AddIn collection
If Not bAvailable Then
 AddIns.Add FileName:="E:\My Documents\Word\Templates\Test.dot",
Install:=True
End If
Set oTemplate = Templates("E:\My Documents\Word\Templates\Test.dot")
oRng.InsertAfter oTemplate.AutoTextEntries("gofish")
End Sub

I am not sure if this is a "good" way or not ;-)

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Hi,
> I'm having dificulty finding a VBA command or script that will let me
[quoted text clipped - 4 lines]
>
> Philip
Witteke - 05 Nov 2006 09:02 GMT
Look there, Autotext III
http://mypage.bluewin.ch/reprobst/FrmSet.htm?Index
Regards

> Hi,
> I'm having dificulty finding a VBA command or script that will let me
[quoted text clipped - 4 lines]
>
> Philip
PPL - 05 Nov 2006 14:36 GMT
Thanks for your suggestions folks. Much appreciated.
Philip
> Hi,
> I'm having dificulty finding a VBA command or script that will let me
[quoted text clipped - 4 lines]
>
> Philip
 
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.