Marcster
11-07-2005, 08:38 AM
Hi people,
I'm trying to automate the Work menu in Word 2000 on my pc.
The Work menu can be located by (if already displayed on Menu Bar):
CommandBars("Menu Bar").Controls("Work").ID 'ID number = 30100 To display the Work menu:
Tools>Customize
Commands tab
Categories: Built-in Menus
Commands: Work
Click and Drag Work to the main menu toolbar, say, next to Help.
What I want is a macro to loop through all items asking if user wants
to delete the item or not.
Also another macro to store the active document to the Work menu.
Also a macro to create or delete the Work menu too.
Any ideas?,
Marcster.
So far have this code:
CommandBars("Menu Bar").Controls("Work").Delete 'Deletes the Work menu
Sub DeleteWorkMenuItem()
Dim i As Integer
Dim rtnDeleteIteme As Integer
For i = 1 To CommandBars("Menu Bar").Controls("Work").Count
' ERRORS:' Object doesn't support this property or method
rtnDeleteItem = MsgBox("Delete " & CommandBars("Menu Bar").Controls("Work").Item(i).Name & _
" from Work menu?", vbYesNo, "Delete item from Work menu")
If rtnDeleteItem = vbNo Then Exit For
If rtnDeleteItem = vbYes Then CommandBars("Menu Bar").Controls("Work").Item(i).Delete
Next i
End Sub
I don't think the Work menu can be looped around in, unlike the other command bars.
I'm trying to automate the Work menu in Word 2000 on my pc.
The Work menu can be located by (if already displayed on Menu Bar):
CommandBars("Menu Bar").Controls("Work").ID 'ID number = 30100 To display the Work menu:
Tools>Customize
Commands tab
Categories: Built-in Menus
Commands: Work
Click and Drag Work to the main menu toolbar, say, next to Help.
What I want is a macro to loop through all items asking if user wants
to delete the item or not.
Also another macro to store the active document to the Work menu.
Also a macro to create or delete the Work menu too.
Any ideas?,
Marcster.
So far have this code:
CommandBars("Menu Bar").Controls("Work").Delete 'Deletes the Work menu
Sub DeleteWorkMenuItem()
Dim i As Integer
Dim rtnDeleteIteme As Integer
For i = 1 To CommandBars("Menu Bar").Controls("Work").Count
' ERRORS:' Object doesn't support this property or method
rtnDeleteItem = MsgBox("Delete " & CommandBars("Menu Bar").Controls("Work").Item(i).Name & _
" from Work menu?", vbYesNo, "Delete item from Work menu")
If rtnDeleteItem = vbNo Then Exit For
If rtnDeleteItem = vbYes Then CommandBars("Menu Bar").Controls("Work").Item(i).Delete
Next i
End Sub
I don't think the Work menu can be looped around in, unlike the other command bars.