Delete Autotext Categories

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.

Thanks

Anita
 
You can't delete AutoText categories, at least not easily. The only way to
do it would be to delete all AutoText entries in the category. You could
recreate them in a different style if you wish. The style for a category
does not need to be in the template that holds the AutoText entry or the
document receiving the entry.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
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 :-)
 
Back
Top