Add Autotext to attached templates

B

barharborboy

Hi folks,

I create script/storyboards for the development of custom Web Based
Training courses. I have a team of writers and keeping course
terminologies standardized is always a problem. I am attempting to
write a macro that will add new terms to the scripting template and
will be accessed from the AutoText drop down menu. I am applying a
unique paragraph style so that they will be grouped together in the
AutoText menu.

I want to be able to do the following:

- Double-click on a word that I want to make a standard term.
- Apply a unique paragraph style to that term
- Copy the term name to the clipboard
- Add that term to the attached script template's Autotext entries

When the dialog opens, I Ctrl-V to paste in the term name. Currently,
I can do everything except get the Autotext to be stored in the
attached template. It goes into the Normal.dot.

Here's the code I'll cobbed together from examples listed here on this
group.

Sub CreateNewAutoText()
ActiveDocument.AttachedTemplate = "eLearning Storyboard template.dot"
Selection.Style = ActiveDocument.Styles("TechTerm")
Selection.Copy
Dim strATName As String
'Get the Autotext Name
Dim Message
Message = "Enter the name for the AutoText Entry" ' Set prompt.
strATName = InputBox(Message)
Selection.CreateAutoTextEntry strATName, strATCategory
End Sub
From what I've read, the CreateAutoTextEntry method cannot select the
template, it defaults to Normal.

Does anyone know of another method, other than the CreateAutoTextEntry
method, to assign a new AutoText entry to an attached template?

I tried using the ThisDocument.AttachedTemplate.AutoTextEntries.Add
Name:=strATName, Range:=Selection.Range statement, but it gives an
error msg.

Any help would be greatly appreciated.
 
B

Bear

Bahabbaboy:

I'm shooting from the hip here, but two ideas occur to me.

First, have you experimented with CustomizationContext? The VBA help doesn't
mention locating AutoText, but that doesn't mean it won't.

Second, if the autotext HAS to land in Normal, how about using
Application.OrganizerCopy and Application.Organizer.Delete to move the entry
from Normal.dot to your desired template?

Bear
 

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