X
XP
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!
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!