PDA

View Full Version : Solved: Word 2000 Work menu



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.

TonyJollans
11-07-2005, 11:18 AM
Hi Marcster,

You are confusing the Work Control on the Menu Bar with the Work Menu itself. It doesn't, however, behave quite like any other commandbar.

To loop through its controls you need to do For i = 1 To CommandBars("Menu Bar").Controls("Work").Controls.Count
You can, however, refer to it directly .. For i = 1 To CommandBars("Work").Controls.Count

You can not delete the controls - they're like the MRU files on the File Menu. I don't know off the top of my head if there is any other way to manipulate them.

Marcster
11-07-2005, 11:44 AM
Hi Tony,
Thanks for showing me my error.
Also a spelling mistake:
Dim rtnDeleteIteme As Integer
should be:
Dim rtnDeleteItem As Integer
I've just been searching Google and have found 'WorkMenuItems' which can be manipulated.
But this, it seems, works for the MAC, I have a PC.

Think this idea about the Work menu won't work.

Maybe try another idea...

Marcster.

TonyJollans
11-07-2005, 12:47 PM
Hi Marcster,

AFAIK, the WorkMenuItems Collection is only on the Mac and there's no PC equivalent.

I don't know how to do what you want (although I can imagine uses for it). I suspect it may not be possible (except perhaps with some complicated Sendkeys).

fumei
11-07-2005, 08:07 PM
Please use the underscore character in your code. It makes it so much better for the rest of us.

Thanks.

Marcster
11-08-2005, 02:39 AM
fumei - Noted, will do in future.

Does anyone know where Word stores the list of entries in the Work menu?.
I've searched the registry and hard drive but can't seem to locate it.

Marcster.

TonyJollans
11-08-2005, 03:21 AM
Hi Marcster,

I don't think this will be of any use to you, but they are stored in ..

HKCU\Software\Microsoft\Office\11.0\Wod\Data, Settings

I think they are stored in memory while Word is open and that the registry value is updated on exit.

The reason you can't find it is that the names are in UTF-16 format in a binary value.

Marcster
11-08-2005, 04:25 AM
Thanks Tony,

This idea can't be done, not easily anyway.

Marking thread as 'Solved' to close this thread.

Thanks,

Marcster.