Menus not showing up in a .doc vs of my template

G

gb0dms

I have coded my menus into my template
when I open the .dot all is fine
but when I open a .doc vs of this the menus do not show
I have this code, not as a module but in the Micorsoft WordObjects\This
Document

Public newControl As CommandBarControl
Public NewMenuBarEntry As CommandBarControl
Public MacrosMenu As CommandBars


Private Sub Document_Open()

Dim i As Long

For i = 1 To CommandBars("Menu Bar").Controls.Count
If i > CommandBars("Menu Bar").Controls.Count Then Exit For
With CommandBars("Menu Bar").Controls(i)
If .Caption Like "*DTP*" Then
.Delete
i = i - 1
End If
End With
Next

Set MacrosMenu = Application.CommandBars
Set NewMenuBarEntry = MacrosMenu("Menu Bar").Controls.Add
(Type:=msoControlPopup, Before:=9)

NewMenuBarEntry.Caption = "DT&P Macros"

' call subroutines to build each menu section
Menu_DataTables
Menu_InsertCharts
Menu_InsertGraphics

End Sub



Private Sub Document_Close()

Dim MacrosMenu As CommandBars

On Error Resume Next

Set MacrosMenu = Application.CommandBars
MacrosMenu("Menu Bar").Controls("DTP Macros").Delete

ActiveDocument.AttachedTemplate.Saved = True

End Sub
 
D

Doug Robbins - Word MVP

Private Sub Document_Open()

should be

Private Sub Document_New()


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

gb0dms

That's it, thanks
I can figure out complex itmes but always miss the obvious
if I have a private sub document open and a private sub docment new
then it works always
 

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