C
Chuck
Hi all
Periodically we need to roll out refreshed a normal.dot to our users (to
make sure the built-in toolbars are standardised and there are no macros
other than the auto macros we prescribe). However we need to preserve users'
autotext and autocorrect entries. The idea is to have the log in script copy
the user's old normal.dot into a temporary location, copy over the user's
autotext and autocorrect entries from the old normal.dot to the refreshed
normal.dot and then delete the old normal.dot.
I've written a sub to delete all autotext entries from the refreshed
normal.dot and to import them from the old normal.dot and it works fine.
However, after import the Insert > AutoText menu shows duplicates of all the
out of the box AutoText entries. The Autotext entries aren't actually
duplicated -- only one of each shows in the Organizer if I exit Word and go
back in the Insert > AuoText menu shows only one of each.
What gives? Any ideas on how I can do what I need to do without having to
restart Word to clean out (ghost) duplicates on the Insert > AutoText menu?
Below is the code I've come up with for copying the AutoText entries. Many
thanks for any suggestions...
Sub AutotextCopy1()
Dim docOldNormal As Word.Document
Dim atxEntry As Word.AutoTextEntry
Set docOldNormal = Word.Documents.Open("c:\temp\xnormal.dot")
For Each atxEntry In NormalTemplate.AutoTextEntries
atxEntry.Delete
Next atxEntry
For Each atxEntry In docOldNormal.AttachedTemplate.AutoTextEntries
Application.OrganizerCopy _
Source:=docOldNormal.AttachedTemplate.FullName, _
Destination:=NormalTemplate.FullName, Name:=atxEntry.Name, _
Object:=wdOrganizerObjectAutoText
Next atxEntry
docOldNormal.Close wdDoNotSaveChanges
End Sub
Periodically we need to roll out refreshed a normal.dot to our users (to
make sure the built-in toolbars are standardised and there are no macros
other than the auto macros we prescribe). However we need to preserve users'
autotext and autocorrect entries. The idea is to have the log in script copy
the user's old normal.dot into a temporary location, copy over the user's
autotext and autocorrect entries from the old normal.dot to the refreshed
normal.dot and then delete the old normal.dot.
I've written a sub to delete all autotext entries from the refreshed
normal.dot and to import them from the old normal.dot and it works fine.
However, after import the Insert > AutoText menu shows duplicates of all the
out of the box AutoText entries. The Autotext entries aren't actually
duplicated -- only one of each shows in the Organizer if I exit Word and go
back in the Insert > AuoText menu shows only one of each.
What gives? Any ideas on how I can do what I need to do without having to
restart Word to clean out (ghost) duplicates on the Insert > AutoText menu?
Below is the code I've come up with for copying the AutoText entries. Many
thanks for any suggestions...
Sub AutotextCopy1()
Dim docOldNormal As Word.Document
Dim atxEntry As Word.AutoTextEntry
Set docOldNormal = Word.Documents.Open("c:\temp\xnormal.dot")
For Each atxEntry In NormalTemplate.AutoTextEntries
atxEntry.Delete
Next atxEntry
For Each atxEntry In docOldNormal.AttachedTemplate.AutoTextEntries
Application.OrganizerCopy _
Source:=docOldNormal.AttachedTemplate.FullName, _
Destination:=NormalTemplate.FullName, Name:=atxEntry.Name, _
Object:=wdOrganizerObjectAutoText
Next atxEntry
docOldNormal.Close wdDoNotSaveChanges
End Sub