View Single Post
  #10   Report Post  
windsurferLA
 
Posts: n/a
Default

windsurferLA wrote:
Bob Phillips wrote:

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.


Thanks... will try your code... WindsurferLA



Per your suggestion, I downloaded John's menu maker. I can get John
Walkenbach menu maker utility to work in a new blank XL97 workbook, but
I can't get it to work in my workbook that already has numerous macros.
The error message that I get is "compile error, user defined type not
defined" and the line

Dim MenuObject as CommandBarPopup

is highlighted.
I note under View\Toobars a toolbar called CommandBar is listed,
possibly because I created it in response to the error message.

I suspect a conflict between one of my macro set up and John's. ANY
SUGGESTIONS?

a screen image can be found at

http://spreadsheet.home.comcast.net/MenuErr1.gif

Thanks in advance... WindsurferLA