Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is a shortcut menu? Jeffry Excel Discussion (Misc queries) 4 May 4th 09 04:03 PM
Submenus on Shortcut Menus ZipCurs Excel Programming 2 March 4th 08 09:12 PM
Popup Menu / Shortcut Menu Dale Fye Excel Discussion (Misc queries) 2 October 12th 07 12:57 AM
shortcut menu Javed Excel Discussion (Misc queries) 1 December 6th 04 09:28 PM


All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"