Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut menu - submenus
Using Office 2007 and Win XP;
I have a shortcut menu that has a couple menus on it, so when you hover on the menu, a sub menu appears. Problem is, everytime I hover on a menu, then hover over another menu, then return to hover over the first menu again, the submenu doubles in size, only with blanks. I have a function I call that deletes the main menu, then re-builds it on each call, and this works fine; but apparently while the main menu is held open and the user switches between menu items, they are not rebuilt. Sorry, I know this probably sounds a little flakey; if unclear please post back and I will try to explain better. I guess I need to delete all the submenu items each time the sub menus are opened; but how? I hate to post all my code due to the complexity and length of the menu system, but below at least is my function that builds one of the submenus. In this example, the first time you hover, only the three items appear, on the second hover, there would be six, then nine, etc. until the main menu is closed, then it starts all over again... Private Function ShortCutMenuPayroll(argShortCutMenu As String) Dim oBar As CommandBar Dim iX As Integer Set oBar = Application.CommandBars(argShortCutMenu) With oBar iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item One" .Controls(iX).OnAction = "Macro1" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Two" .Controls(iX).OnAction = "Macro2" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Three" .Controls(iX).OnAction = "Macro3" .Controls(iX).BeginGroup = True End With End Function Thanks for your assistance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut menu - submenus
Hi, since initially posting, I solved my issue by adding the following to my code: If oBar.Controls(x).Controls.Count 0 Then Exit Function This way if the submenu has any controls on it, it won't be redrawn. "XP" wrote: Using Office 2007 and Win XP; I have a shortcut menu that has a couple menus on it, so when you hover on the menu, a sub menu appears. Problem is, everytime I hover on a menu, then hover over another menu, then return to hover over the first menu again, the submenu doubles in size, only with blanks. I have a function I call that deletes the main menu, then re-builds it on each call, and this works fine; but apparently while the main menu is held open and the user switches between menu items, they are not rebuilt. Sorry, I know this probably sounds a little flakey; if unclear please post back and I will try to explain better. I guess I need to delete all the submenu items each time the sub menus are opened; but how? I hate to post all my code due to the complexity and length of the menu system, but below at least is my function that builds one of the submenus. In this example, the first time you hover, only the three items appear, on the second hover, there would be six, then nine, etc. until the main menu is closed, then it starts all over again... Private Function ShortCutMenuPayroll(argShortCutMenu As String) Dim oBar As CommandBar Dim iX As Integer Set oBar = Application.CommandBars(argShortCutMenu) With oBar iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item One" .Controls(iX).OnAction = "Macro1" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Two" .Controls(iX).OnAction = "Macro2" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Three" .Controls(iX).OnAction = "Macro3" .Controls(iX).BeginGroup = True End With End Function Thanks for your assistance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut menu - submenus
On Oct 28, 4:11 pm, XP wrote:
Using Office 2007 and Win XP; I have a shortcut menu that has a couple menus on it, so when you hover on the menu, a sub menu appears. Problem is, everytime I hover on a menu, then hover over another menu, then return to hover over the first menu again, the submenu doubles in size, only with blanks. I have a function I call that deletes the main menu, then re-builds it on each call, and this works fine; but apparently while the main menu is held open and the user switches between menu items, they are not rebuilt. Sorry, I know this probably sounds a little flakey; if unclear please post back and I will try to explain better. I guess I need to delete all the submenu items each time the sub menus are opened; but how? I hate to post all my code due to the complexity and length of the menu system, but below at least is my function that builds one of the submenus. In this example, the first time you hover, only the three items appear, on the second hover, there would be six, then nine, etc. until the main menu is closed, then it starts all over again... Private Function ShortCutMenuPayroll(argShortCutMenu As String) Dim oBar As CommandBar Dim iX As Integer Set oBar = Application.CommandBars(argShortCutMenu) With oBar iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item One" .Controls(iX).OnAction = "Macro1" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Two" .Controls(iX).OnAction = "Macro2" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Three" .Controls(iX).OnAction = "Macro3" .Controls(iX).BeginGroup = True End With End Function Thanks for your assistance! Just build the menu once when you open the workbook and remove it when you close the workbook. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut menu - submenus
Thanks, but that doesn't work in this case; part of what you can't see in my program is that it is tied to Workbook_Activate and Workbook_Deactivate events; the menu necessarily needs to be built and rebuilt as the users switch between books... "dbKemp" wrote: On Oct 28, 4:11 pm, XP wrote: Using Office 2007 and Win XP; I have a shortcut menu that has a couple menus on it, so when you hover on the menu, a sub menu appears. Problem is, everytime I hover on a menu, then hover over another menu, then return to hover over the first menu again, the submenu doubles in size, only with blanks. I have a function I call that deletes the main menu, then re-builds it on each call, and this works fine; but apparently while the main menu is held open and the user switches between menu items, they are not rebuilt. Sorry, I know this probably sounds a little flakey; if unclear please post back and I will try to explain better. I guess I need to delete all the submenu items each time the sub menus are opened; but how? I hate to post all my code due to the complexity and length of the menu system, but below at least is my function that builds one of the submenus. In this example, the first time you hover, only the three items appear, on the second hover, there would be six, then nine, etc. until the main menu is closed, then it starts all over again... Private Function ShortCutMenuPayroll(argShortCutMenu As String) Dim oBar As CommandBar Dim iX As Integer Set oBar = Application.CommandBars(argShortCutMenu) With oBar iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item One" .Controls(iX).OnAction = "Macro1" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Two" .Controls(iX).OnAction = "Macro2" iX = iX + 1 .Controls.Add Type:=msoControlButton .Controls(iX).Caption = "Item Three" .Controls(iX).OnAction = "Macro3" .Controls(iX).BeginGroup = True End With End Function Thanks for your assistance! Just build the menu once when you open the workbook and remove it when you close the workbook. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What is a shortcut menu? | Excel Discussion (Misc queries) | |||
Submenus on Shortcut Menus | Excel Programming | |||
Popup Menu / Shortcut Menu | Excel Discussion (Misc queries) | |||
shortcut menu | Excel Discussion (Misc queries) |