Hi =?Utf-8?B?QW5pdGE=?=,
How can I delete the categories that are listed when I click the All Entries
button on the AutoText toolbar? I tried deleting the style, but for some,
the style isn't there.
If you want to do this without deleting the entries (as Charles mentions) then
you'd need a macro that reassigns the entries in a particular category to a
different category by inserting them and applying a different style name (that
exists in the document), then recreating the entry. For example:
Sub REassignAutoText()
Dim ATs As Word.AutoTextEntries
Dim AT As Word.AutoTextEntry
Dim nEntries As Long, i As Long
Dim rng As Word.Range
Dim entryName As String
Dim oldStyle As String
Dim newStyle As String
CustomizationContext = NormalTemplate
Set ATs = NormalTemplate.AutoTextEntries
nEntries = ATs.Count
oldStyle = "test"
newStyle = "Salutation"
Selection.Range.Paragraphs(1).Style = newStyle
For i = nEntries To 1 Step -1
If ATs.Item(i).StyleName = oldStyle Then
Set rng = ATs.Item(i).Insert(Selection.Range, True)
rng.Style = newStyle
NormalTemplate.AutoTextEntries.Add _
Name:=ATs.Item(i).Name, Range:=rng
rng.Delete
entryName = ATs.Item(i).Name
End If
Next
'Last entry isn't recognized as having been changed
'and doesn't appear in any list, so do it again
Set rng = ATs.Item(entryName).Insert(Selection.Range, True)
rng.Style = newStyle
NormalTemplate.AutoTextEntries.Add _
Name:=ATs.Item(entryName).Name, Range:=rng
rng.Delete
End Sub
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail
