Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Hi I use the code below to create a popup menu that shows unhidden tabs in a
workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Not unless you build your own custom popup menu.
http://support.microsoft.com/default...b;en-us;830502 How to customize menus and menu bars in Excel http://support.microsoft.com/?id=159619 XL97: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/?id=213550 XL2000: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/default...b;en-us;166755 File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R) Excel 97 File Name: WE1183.EXE File Size: 58041 bytes File Date: 06/20/97 Keywords: kbfile kbappnote Description: This Application Note can help you learn techniques for writing Visual Basic(R) for Applications code to customize menus in Microsoft Excel 97. This Application Note contains code examples that you can use with the following elements: menu bars, menus, menu items, submenus, and shortcut menus. -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi I use the code below to create a popup menu that shows unhidden tabs in a workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Hi Tom,
Thanks for the links I have managed to get half way, that is I have a menu called "MyMenu" added to the menu bar. On clicking this I have a sub menu heading of Apple which leads to sub sub menu headings of "Apple1 and Apple2" When these are clicked the macros run and take me to the page required. 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu.Caption = "Apple" With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With End Sub This runs and works without any problems, so I haven't shown all the other elements of the code. Ok what I'm stuck on is I want to have in the "my menu" the sub menu Apple and another sub menu called orange, I then want the orange to have sub sub menus of "Orange1 and Orange2" just like I have done for Apple. I have tried a few ways but cant get this right, so any help would be so welcomed. Thanks "Tom Ogilvy" wrote: Not unless you build your own custom popup menu. http://support.microsoft.com/default...b;en-us;830502 How to customize menus and menu bars in Excel http://support.microsoft.com/?id=159619 XL97: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/?id=213550 XL2000: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/default...b;en-us;166755 File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R) Excel 97 File Name: WE1183.EXE File Size: 58041 bytes File Date: 06/20/97 Keywords: kbfile kbappnote Description: This Application Note can help you learn techniques for writing Visual Basic(R) for Applications code to customize menus in Microsoft Excel 97. This Application Note contains code examples that you can use with the following elements: menu bars, menus, menu items, submenus, and shortcut menus. -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi I use the code below to create a popup menu that shows unhidden tabs in a workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
'Adds a new menu to menu bar
cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu1 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu1.Caption = "Apple" With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With Set cbcCutomMenu2 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu2.Caption = "Orange" With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange1" .OnAction = "Gotoorange1" End With With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange2" .OnAction = "Gotoorange2" End With End Sub -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi Tom, Thanks for the links I have managed to get half way, that is I have a menu called "MyMenu" added to the menu bar. On clicking this I have a sub menu heading of Apple which leads to sub sub menu headings of "Apple1 and Apple2" When these are clicked the macros run and take me to the page required. 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu.Caption = "Apple" With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With End Sub This runs and works without any problems, so I haven't shown all the other elements of the code. Ok what I'm stuck on is I want to have in the "my menu" the sub menu Apple and another sub menu called orange, I then want the orange to have sub sub menus of "Orange1 and Orange2" just like I have done for Apple. I have tried a few ways but cant get this right, so any help would be so welcomed. Thanks "Tom Ogilvy" wrote: Not unless you build your own custom popup menu. http://support.microsoft.com/default...b;en-us;830502 How to customize menus and menu bars in Excel http://support.microsoft.com/?id=159619 XL97: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/?id=213550 XL2000: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/default...b;en-us;166755 File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R) Excel 97 File Name: WE1183.EXE File Size: 58041 bytes File Date: 06/20/97 Keywords: kbfile kbappnote Description: This Application Note can help you learn techniques for writing Visual Basic(R) for Applications code to customize menus in Microsoft Excel 97. This Application Note contains code examples that you can use with the following elements: menu bars, menus, menu items, submenus, and shortcut menus. -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi I use the code below to create a popup menu that shows unhidden tabs in a workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Hi Tom,
Works a treat, as simple as it is I would have never got that, thank you so much. I was thinking is there a way to make the sub menu's ie "Apple" Enabled True and False Dependant on a command check box which is located on Sheets("Opening Cover") Thanks again for the help, that custom menu works a treat. "Tom Ogilvy" wrote: 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu1 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu1.Caption = "Apple" With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With Set cbcCutomMenu2 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu2.Caption = "Orange" With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange1" .OnAction = "Gotoorange1" End With With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange2" .OnAction = "Gotoorange2" End With End Sub -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi Tom, Thanks for the links I have managed to get half way, that is I have a menu called "MyMenu" added to the menu bar. On clicking this I have a sub menu heading of Apple which leads to sub sub menu headings of "Apple1 and Apple2" When these are clicked the macros run and take me to the page required. 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu.Caption = "Apple" With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With End Sub This runs and works without any problems, so I haven't shown all the other elements of the code. Ok what I'm stuck on is I want to have in the "my menu" the sub menu Apple and another sub menu called orange, I then want the orange to have sub sub menus of "Orange1 and Orange2" just like I have done for Apple. I have tried a few ways but cant get this right, so any help would be so welcomed. Thanks "Tom Ogilvy" wrote: Not unless you build your own custom popup menu. http://support.microsoft.com/default...b;en-us;830502 How to customize menus and menu bars in Excel http://support.microsoft.com/?id=159619 XL97: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/?id=213550 XL2000: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/default...b;en-us;166755 File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R) Excel 97 File Name: WE1183.EXE File Size: 58041 bytes File Date: 06/20/97 Keywords: kbfile kbappnote Description: This Application Note can help you learn techniques for writing Visual Basic(R) for Applications code to customize menus in Microsoft Excel 97. This Application Note contains code examples that you can use with the following elements: menu bars, menus, menu items, submenus, and shortcut menus. -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi I use the code below to create a popup menu that shows unhidden tabs in a workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
'Adds a new menu to menu bar
cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu1 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu1.Caption = "Apple" With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With '--------------- if Worksheets("Opening Cover").OleObject("CheckBox1").Object.Value then cbcCutomMenu1.Enabled = False End if '-------------- Set cbcCutomMenu2 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu2.Caption = "Orange" With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange1" .OnAction = "Gotoorange1" End With With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange2" .OnAction = "Gotoorange2" End With End Sub -- Regards, Tom Ogilvy "Newbeetle" wrote in message ... Hi Tom, Works a treat, as simple as it is I would have never got that, thank you so much. I was thinking is there a way to make the sub menu's ie "Apple" Enabled True and False Dependant on a command check box which is located on Sheets("Opening Cover") Thanks again for the help, that custom menu works a treat. "Tom Ogilvy" wrote: 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu1 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu1.Caption = "Apple" With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With Set cbcCutomMenu2 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu2.Caption = "Orange" With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange1" .OnAction = "Gotoorange1" End With With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange2" .OnAction = "Gotoorange2" End With End Sub -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi Tom, Thanks for the links I have managed to get half way, that is I have a menu called "MyMenu" added to the menu bar. On clicking this I have a sub menu heading of Apple which leads to sub sub menu headings of "Apple1 and Apple2" When these are clicked the macros run and take me to the page required. 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu.Caption = "Apple" With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With End Sub This runs and works without any problems, so I haven't shown all the other elements of the code. Ok what I'm stuck on is I want to have in the "my menu" the sub menu Apple and another sub menu called orange, I then want the orange to have sub sub menus of "Orange1 and Orange2" just like I have done for Apple. I have tried a few ways but cant get this right, so any help would be so welcomed. Thanks "Tom Ogilvy" wrote: Not unless you build your own custom popup menu. http://support.microsoft.com/default...b;en-us;830502 How to customize menus and menu bars in Excel http://support.microsoft.com/?id=159619 XL97: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/?id=213550 XL2000: Sample Macros for Customizing Menus and Submenus http://support.microsoft.com/default...b;en-us;166755 File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R) Excel 97 File Name: WE1183.EXE File Size: 58041 bytes File Date: 06/20/97 Keywords: kbfile kbappnote Description: This Application Note can help you learn techniques for writing Visual Basic(R) for Applications code to customize menus in Microsoft Excel 97. This Application Note contains code examples that you can use with the following elements: menu bars, menus, menu items, submenus, and shortcut menus. -- Regards, Tom Ogilvy "Newbeetle" wrote: Hi I use the code below to create a popup menu that shows unhidden tabs in a workbook so that you can navigate to them quickly. Option Explicit 'to create index popup on menu when you right mouse click on screen Sub IndexCode() Application.CommandBars("workbook Tabs").ShowPopup End Sub Is it possible to modify so that it lists certain tab names only, which then if clicked have sub menus ie on a right mouse click and then clicking sheet index I see tab names Car Bed House Then on clicking one of the items I see Car Car 1 Car 2 Car 3 Hope that makes sense. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Hi Tom,
I tried the code amendment but I get an error on the if statement, I have checked the code but cant see the wood for the tree's from staring too long! I then tried some amendments and ended on; If Sheets("Opening Cover").CheckBox1.Value = False Then cbcCutomMenu1.Enabled = False End if If I run the excel program after saving with checkbox 1 unchecked, the Apple is not enabled. If I run the excel program after saving with checkbox 1 checked, the apple is enabled. I cant though get this function to work when checking/un-checking the checkbox in the open workbook. Yep I'm stuck yet again, any thoughts appreciated! "Tom Ogilvy" wrote: 'Adds a new menu to menu bar cbcCutomMenu.Caption = "My Menu" Set cbcCutomMenu1 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu1.Caption = "Apple" With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple1" .OnAction = "Gotoapple1" End With With cbcCutomMenu1.Controls.Add(Type:=msoControlButton) .Caption = "Apple2" .OnAction = "Gotoapple2" End With '--------------- if Worksheets("Opening Cover").OleObject("CheckBox1").Object.Value then cbcCutomMenu1.Enabled = False End if '-------------- Set cbcCutomMenu2 = cbcCutomMenu.Controls.Add(Type:=msoControlPopup) cbcCutomMenu2.Caption = "Orange" With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange1" .OnAction = "Gotoorange1" End With With cbcCutomMenu2.Controls.Add(Type:=msoControlButton) .Caption = "Orange2" .OnAction = "Gotoorange2" End With End Sub -- Regards, Tom Ogilvy |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
Hi Tom,
I figured it out, I got checkbox1 to run macro "addmenus" everytime its checked or unchecked. Thanks for the help with this, its really been appreciated. "Newbeetle" wrote: Hi Tom, I tried the code amendment but I get an error on the if statement, I have checked the code but cant see the wood for the tree's from staring too long! I then tried some amendments and ended on; If Sheets("Opening Cover").CheckBox1.Value = False Then cbcCutomMenu1.Enabled = False End if If I run the excel program after saving with checkbox 1 unchecked, the Apple is not enabled. If I run the excel program after saving with checkbox 1 checked, the apple is enabled. I cant though get this function to work when checking/un-checking the checkbox in the open workbook. Yep I'm stuck yet again, any thoughts appreciated! |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Index Popup
There was a typo
if Worksheets("Opening Cover").OleObject("CheckBox1").Object.Value then cbcCutomMenu1.Enabled = False End if should have been if Worksheets("Opening Cover").OleObjects("CheckBox1").Object.Value then cbcCutomMenu1.Enabled = False End if Yes, you will need alter the menu based on the click event of the checkbox. You don't necessarily need to rerun addmenus, you could just set the enable property of the control to false. you would have to address it like CommandBars("Something").Controls("MyMenu").Enable d = False ' or true "Something" would be the name of the commandbar on which it is located. -- regards, Tom Ogivly "Newbeetle" wrote in message ... Hi Tom, I figured it out, I got checkbox1 to run macro "addmenus" everytime its checked or unchecked. Thanks for the help with this, its really been appreciated. "Newbeetle" wrote: Hi Tom, I tried the code amendment but I get an error on the if statement, I have checked the code but cant see the wood for the tree's from staring too long! I then tried some amendments and ended on; If Sheets("Opening Cover").CheckBox1.Value = False Then cbcCutomMenu1.Enabled = False End if If I run the excel program after saving with checkbox 1 unchecked, the Apple is not enabled. If I run the excel program after saving with checkbox 1 checked, the apple is enabled. I cant though get this function to work when checking/un-checking the checkbox in the open workbook. Yep I'm stuck yet again, any thoughts appreciated! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to popup msg box ? | Excel Programming | |||
calendar popup | Excel Discussion (Misc queries) | |||
popup box | Excel Programming | |||
"Why did we get here????" popup | Excel Discussion (Misc queries) | |||
Are you sure popup box | Excel Programming |