View Single Post
  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

You could write a simple VB routine that would extract the details from your
menu, and put it in a worksheet.

For example, say your menu is called "WindSurfer", this should be a start


Private iLevel As Long
Private iRow As Long

Sub ReverseMenu()
Const kMenu As String = "Windsurfer"
Dim oCtl As CommandBarControl

On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Menu Maker").Delete
Application.DisplayAlerts = True
On Error GoTo 0
Worksheets.Add.Name = "Menu Maker"
Range("A1").Value = "Level"
Range("B1").Value = "Caption"
Range("C1").Value = "Position/Macro"
Range("D1").Value = "Divider"
Range("E1").Value = "Face Id"

iLevel = 1
iRow = 2
With Application.CommandBars("Worksheet Menu Bar")
Range("A2").Value = iLevel
Range("B2").Value = kMenu
Range("C2").Value = ""
Range("D2").Value = IIf(.Controls(kMenu).BeginGroup, "TRUE", "")
Range("E2").Value = ""
nextlevel .Controls(kMenu)
End With

End Sub

Sub nextlevel(ctlParent As CommandBarControl)
Dim ctl As CommandBarControl

iLevel = iLevel + 1
For Each ctl In ctlParent.Controls
iRow = iRow + 1
Cells(iRow, "A").Value = iLevel
Cells(iRow, "B").Value = ctl.Caption
Cells(iRow, "C").Value = ctl.OnAction
Cells(iRow, "D").Value = IIf(ctl.BeginGroup, "TRUE", "")
If ctl.Type = msoControlPopup Then
Cells(iRow, "E").Value = ""
Else
Cells(iRow, "E").Value = ctl.FaceId
End If
If ctl.Type = msoControlPopup Then
nextlevel ctl
End If
Next ctl
iLevel = iLevel - 1
End Sub

You will need to add the position of the first item, and modfy the onACtions
if they have a full path, but it is a start.

If you arer creating a custom toolbar, it will need some modification.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"windsurferLA" wrote in message
...
Bob Phillips wrote:
Also, if you use John Walk's Menu Maker it will be relatively easy.

Try it out on a couple of the macros and get the fell of it. Then just

jot
down all your macros and menu structures on a bit of paper, and

transcribing
to the Menu Maker is a piece of cake. You are talking a few hours at

most.

I mistakenly started constructing new macros before studying John Walk's
Menu Maker. After building much of my menu structure, I realized that
once a custom menu structure is added to one workbook, it appears in all
workbooks. I then realized that I could place menu items in a custom
menu that is revealed and hidden as the workbook is opened and closed.
However, John Walk's approach seems better as the menu items can't be
inadvertently altered when running another workbook. I expect I'll go
back and reconstruct menu's using his tool.

Is there a way to capture the details of menu items that I've entered
using standard XL97 procedures, so I can cut an paste them into sheets
formated according to John Walk's procedure? Alternatively, is there a
way to capture the XL95 menu items from my old workbook in either XL95
or XL97?

Can you point me to any other ways, if there are any, are there to
restrict custom menu items to specific workbook?

Thanks for the help. WindsurferLA