command bar won't delete in 2003

M

Martin

This appears to be a bug in Word 2003:

We run code (by way of AutoExec macro in a global template in the Startup
folder) to delete and then rebuild a company toolbar when the user starts
Word. The following line deletes the Company toolbar:

CommandBars("Company").Delete

In Word 2003 when you go to Tools, Customize it will be gone. However it is
still there when you look at the Organizer (from Tools, Templates and
Add-ins) and, sure enough, when you restart Word 2003 the toolbar is back (in
Word 97 it works fine, immediately disappearing from both Customize and
Organizer).

There's been some talk about CustomizationContext in previous threads but
I've stepped through the code and the Context remains "Normal.dot"
throughout. I've also checked the path of the Normal template in the
Organizer so I know it's not another normal.dot I'm dealing with.

Any ideas please? The users are on my back with all the duplicate toolbars
that have started appearing in their Word...
 
M

Martin

Well I've solved it: it does appear to be a bug (CommandBar.Delete only
removes toolbars temporarily in 2003). Using the macro recorder and
replacing the hard paths that appear, I've come up with the following (which
is fortunately backwardly compatible to 97):

Application.OrganizerDelete Source:= _
NormalTemplate.Path & "\Normal.dot" _
, Name:="Company", Object:=wdOrganizerObjectCommandBars

This deletes the toolbar properly from the source template (in my case the
normal template of the particular user).
 

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