M
Michael Ripberger
I am interested in optimizing the code below. The Word object model doesn't
seem to have a way to "see" if the Normal template has these 4 module in it
already. So I am forced to delete them and then re-copy them--this takes 5-6
seconds each time Word starts up. It would be quicker to query for them
first somehow and only copy the ones that weren't there. If I try to copy
and the module already exists, word raises an error. Any help would be
appreciated.
With Application
.OrganizerDelete Application.NormalTemplate.FullName, _
"AutoClose", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"AutoOpen", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"NORMALAutoClose", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"NORMALAutoOpen", wdOrganizerObjectProjectItems
End With
With Application
.OrganizerCopy strAutoMacroTemplate,
NormalTemplate.FullName, _
"NORMALAutoClose", wdOrganizerObjectProjectItems
.OrganizerCopy strAutoMacroTemplate,
NormalTemplate.FullName, _
"NORMALAutoOpen", wdOrganizerObjectProjectItems
.OrganizerRename NormalTemplate.FullName, "NORMALAutoClose",
_
"AutoClose", wdOrganizerObjectProjectItems
.OrganizerRename NormalTemplate.FullName, "NORMALAutoOpen",
_
"AutoOpen", wdOrganizerObjectProjectItems
End With
seem to have a way to "see" if the Normal template has these 4 module in it
already. So I am forced to delete them and then re-copy them--this takes 5-6
seconds each time Word starts up. It would be quicker to query for them
first somehow and only copy the ones that weren't there. If I try to copy
and the module already exists, word raises an error. Any help would be
appreciated.
With Application
.OrganizerDelete Application.NormalTemplate.FullName, _
"AutoClose", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"AutoOpen", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"NORMALAutoClose", wdOrganizerObjectProjectItems
.OrganizerDelete Application.NormalTemplate.FullName, _
"NORMALAutoOpen", wdOrganizerObjectProjectItems
End With
With Application
.OrganizerCopy strAutoMacroTemplate,
NormalTemplate.FullName, _
"NORMALAutoClose", wdOrganizerObjectProjectItems
.OrganizerCopy strAutoMacroTemplate,
NormalTemplate.FullName, _
"NORMALAutoOpen", wdOrganizerObjectProjectItems
.OrganizerRename NormalTemplate.FullName, "NORMALAutoClose",
_
"AutoClose", wdOrganizerObjectProjectItems
.OrganizerRename NormalTemplate.FullName, "NORMALAutoOpen",
_
"AutoOpen", wdOrganizerObjectProjectItems
End With