I have a puzzling issue related to different users using Word documents that
have a custom template with a custom menu attached.
I created the custom menu in a custom template, using the code at the bottom
of this message. After I run OurMenu, the menu and submenus are created in
the custom template. I then attach the custom template to the Word documents
for which I need this menu. The template is attached as a Document Template,
not a Global Template.
All of these files are on a network drive. I did all of the above using
Word on my computer and accessing the template and Word documents stored on
the network drive. When I had it all set up and working great for me, I then
gave a coworker permissions to the network folder, and she was going to work
on these documents also. However, when she opens the Word documents, she
does not get the custom menu, even though she is accessing the exact same
Word documents with the exact same custom template attached. (And yes, she
has macros enabled.) To get it to work, I have to basically open the custom
template re-run OurMenu on her computer to create the menu again, and then
save it. Then the menu appears in the documents on her computer.
The computer guy who helped me out with this said he suspects something is
awry with our use of the CustomizationContext in the OurMenu subroutine, but
he wasn’t a Template expert so he wasn’t sure exactly what was wrong. That
was just a guess, and he wasn’t sure how to fix it if that was the problem.
This is causing a lot of headaches. I have a feeling there is a lot about
templates that I don’t know anything about. I’d love any help or a point in
the right direction. I’m totally baffled how two different computers could
have different menus for a document with the same attached template.
Thanks,
Tom
* * * * * *
Public Sub OurMenu()
CustomizationContext = ActiveDocument.AttachedTemplate
'Create Menu
Dim existingMenuBar As CommandBar
Dim newMenu As CommandBarPopup
Dim subMenu As CommandBarPopup
Dim subMenu2 As CommandBarButton
Dim subMenu3 As CommandBarButton
Set existingMenuBar = CommandBars.ActiveMenuBar
Set newMenu = existingMenuBar.Controls.Add(Type:=msoControlPopup)
With newMenu
.Tag = "Comment Menu"
.Caption = "Comment Menu"
.Width = 85
.Visible = True
End With
'Sub Menu 01
Set subMenu = newMenu.Controls.Add(Type:=msoControlPopup)
With subMenu
.Caption = "01 - Additional Review"
End With
Call DoSubMenu("01", subMenu)
'Sub Menu 02
Set subMenu = newMenu.Controls.Add(Type:=msoControlPopup)
With subMenu
.Caption = "02 - Scope"
End With
Call DoSubMenu("02", subMenu)
[other submenus here, similar to 01 and 02]
Set subMenu3 = newMenu.Controls.Add(Type:=msoControlButton)
With subMenu3
.Caption = "UNHighlight All"
.OnAction = "TopicUnhigh" [TopicUnhigh subroutine omitted]
End With
Set subMenu3 = newMenu.Controls.Add(Type:=msoControlButton)
With subMenu3
.Caption = "Highlight All Unmarked"
.OnAction = "HighAll" [HighAll subroutine omitted]
End With
End Sub
* * * * * *
Public Sub DoSubMenu(topicnum As String, themainmenu As CommandBarPopup)
Dim themenu As CommandBarButton
Set themenu = themainmenu.Controls.Add(Type:=msoControlButton)
With themenu
.Caption = "Mark Topic"
.TooltipText = "Mark Topic"
.Style = msoButtonCaption
.OnAction = "Topic" & topicnum
End With
Set themenu = themainmenu.Controls.Add(Type:=msoControlButton)
With themenu
.Caption = "Highlight Topic"
.TooltipText = "Highlight Topic"
.Style = msoButtonCaption
.OnAction = "Topic" & topicnum & "High"
End With
End Sub
Graham Mayor - 28 Mar 2007 05:42 GMT
Why don't you simply set this menu system up in a global template and make
that template available to all users who require it, by setting the Word
startup folder to the network location?

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I have a puzzling issue related to different users using Word
> documents that have a custom template with a custom menu attached.
[quoted text clipped - 108 lines]
>
> End Sub