G
Greg Maxey
I don't have a lot of experience customizing menus and toolbars
programatically and I am having fits with the following code. I call this
procedure with and AutoNew, AutoOpen macros and from several other
procedures in a larger project. The calls and code are doing what I want
them to do but for some reason everytime I run through the process and then
close Word I get a prompt that changes have been made to normal.dot and asks
if I want to save those changes.
The project and all the code are part of a template where I added a menu
("Document Bundle) to the menu bar that has three commands. I saved this
customization in the template (not the normal template).
I have used a msgbox to confirm that the customizationcontent is set to the
template containing the menu and not normal.dot. I can't figure out why
when I close Word that I get the prompt to save normal..dot.
Can anyone help? Thanks.
Sub ConfigMenu()
Dim myMenu As CommandBarControl
CustomizationContext = ActiveDocument.AttachedTemplate
'Msgbox ActiveDocument.AttachedTemplate 'Used for testing
Set myMenu = CommandBars("Menu Bar").Controls("Document Bundle")
With myMenu
If bEnableCreate Then
.Controls("Create Bundle").Enabled = True
Else
.Controls("Create Bundle").Enabled = False
End If
If bEnableUpdate Then
.Controls("Update Bundle").Enabled = True
Else
.Controls("Update Bundle").Enabled = False
End If
End With
ActiveDocument.AttachedTemplate.Save
End Sub
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
McCain/Palin '08 !!!
programatically and I am having fits with the following code. I call this
procedure with and AutoNew, AutoOpen macros and from several other
procedures in a larger project. The calls and code are doing what I want
them to do but for some reason everytime I run through the process and then
close Word I get a prompt that changes have been made to normal.dot and asks
if I want to save those changes.
The project and all the code are part of a template where I added a menu
("Document Bundle) to the menu bar that has three commands. I saved this
customization in the template (not the normal template).
I have used a msgbox to confirm that the customizationcontent is set to the
template containing the menu and not normal.dot. I can't figure out why
when I close Word that I get the prompt to save normal..dot.
Can anyone help? Thanks.
Sub ConfigMenu()
Dim myMenu As CommandBarControl
CustomizationContext = ActiveDocument.AttachedTemplate
'Msgbox ActiveDocument.AttachedTemplate 'Used for testing
Set myMenu = CommandBars("Menu Bar").Controls("Document Bundle")
With myMenu
If bEnableCreate Then
.Controls("Create Bundle").Enabled = True
Else
.Controls("Create Bundle").Enabled = False
End If
If bEnableUpdate Then
.Controls("Update Bundle").Enabled = True
Else
.Controls("Update Bundle").Enabled = False
End If
End With
ActiveDocument.AttachedTemplate.Save
End Sub
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
McCain/Palin '08 !!!