I'm having a similar problem as the person originally posting. I've created a
global template that stores macros and AutoText entries for use by all users
in our office. I want the user to be able to run a macro that inserts the
AutoText but I'm getting a Run Time error because it's looking for AutoText
in the document when it the AutoText is actually stored in the global
template. The advantage to writing a macro to insert the AutoText is I can
insert Input Boxes into the inserted AutoText for boilerplate automation.
This, of course, works swell if I have the template open. But not when I
simply add the template as a global.
Like the person posting this question, I need to know how to get it to look
for AutoText in the *template*. The template is added using "Templates and
Add-Ins."
Claudia
> Assuming that you're working with macrobuttons to show checkboxes etc, the
> underlying macros would need to be stored in an add in and that add in would
> need to be loaded. Is the template that contains your macrobutton in your
> Startup folder?
Chuck - 09 Mar 2005 17:23 GMT
Try this, where "AutoText.dot" is the template where you've stored your
autotext entry and AUTOTEXT_PATH is where AutoText.dot is located:
Dim tmpTemplate As Template
Set tmpTemplate = Templates("C:\AUTOTEXT_PATH\AutoText.dot")
tmpTemplate.AutoTextEntries("YourAutoTextEntryName").Insert _
Where:=Selection.Range
Set tmpTemplate = Nothing
> I'm having a similar problem as the person originally posting. I've created a
> global template that stores macros and AutoText entries for use by all users
[quoted text clipped - 16 lines]
> > need to be loaded. Is the template that contains your macrobutton in your
> > Startup folder?
Chuck - 09 Mar 2005 17:25 GMT
PS -- your autotext template may still need to be loaded as a global
template. You can do that as follows, I do it in Normal.dot AutoExec macro
so it's available from the get go:
If Dir$("C:\AUTOTEXT_PATH\AutoText.Dot") <> "" Then
'load add in
AddIns.Add _
FileName:="C:\AUTOTEXT_PATH\AutoText.Dot", _
Install:=True
End If
> I'm having a similar problem as the person originally posting. I've created a
> global template that stores macros and AutoText entries for use by all users
[quoted text clipped - 16 lines]
> > need to be loaded. Is the template that contains your macrobutton in your
> > Startup folder?
Claudia - 09 Mar 2005 23:29 GMT
> PS -- your autotext template may still need to be loaded as a global template. <
So, it's not sufficient to have the global template loaded from Templates
and Add-Ins? Here's the macro as I've rewritten it. It's not working - still
getting a Run Time error. If you could tell me where I have it wrong, that
would be wonderful (this is run with the global template loaded).
Sub TestAutoTextInsert()
'
' TestAutoTextInsert Macro
' Macro recorded 3/9/2005 by Claudia Carvalho
'
Dim tmpTemplate As Template
Set tmpTemplate = Templates("V:\Forms_Word\OFFICE\Macros.dot")
tmpTemplate.AutoTextEntries("Intro Rogs Answer").Insert _
Where:=Selection.Range
Set tmpTemplate = Nothing
End Sub
Chuck - 10 Mar 2005 11:29 GMT
What specific run time error are you getting? "5941 - The requested member
of the collection does not exist"? Are you sure your autotext entry name is
spelled correctly? Are you sure the global template is actually loaded?
It should work whether you load the global template manually or through code.
Chuck
> > PS -- your autotext template may still need to be loaded as a global template. <
>
[quoted text clipped - 18 lines]
>
> End Sub