![]() |
Add Command to RightClick Menu
I have a real simple routine that use to add a new command to the RightClick
Menu. Sub CreateRightClick() With Application.CommandBars("Cell").Controls.Add .Caption = "Remove" .OnAction = "Remove" End With End Sub But for some reason, now it does not work. Nothing is add to the RightClick menu. What I want is "Remove" added to the menu and when clicked, for it to run the macro "Remove". Two, can I add other commands with "Sub CreateRightClick2()". I have only added one command before. Any Help is Always Appreciated. |
Add Command to RightClick Menu
I don't know why it didn't work. maybe there was an error in the runcode.
Have you tried stepping through it? Does Remove already exist on the menu. You can add m ultiples like so Sub CreateRightClick() With Application.CommandBars("Cell") With .Controls.Add .Caption = "Remove" .OnAction = "Remove" End With With .Controls.Add .Caption = "Remove2" .OnAction = "Remove2" End With End With End Sub -- HTH ------- Bob Phillips "Ronbo" wrote in message ... I have a real simple routine that use to add a new command to the RightClick Menu. Sub CreateRightClick() With Application.CommandBars("Cell").Controls.Add .Caption = "Remove" .OnAction = "Remove" End With End Sub But for some reason, now it does not work. Nothing is add to the RightClick menu. What I want is "Remove" added to the menu and when clicked, for it to run the macro "Remove". Two, can I add other commands with "Sub CreateRightClick2()". I have only added one command before. Any Help is Always Appreciated. |
Add Command to RightClick Menu
"Ronbo" wrote: I have a real simple routine that use to add a new command to the RightClick Menu. Sub CreateRightClick() With Application.CommandBars("Cell").Controls.Add .Caption = "Remove" .OnAction = "Remove" End With End Sub But for some reason, now it does not work. Nothing is add to the RightClick menu. What I want is "Remove" added to the menu and when clicked, for it to run the macro "Remove". Two, can I add other commands with "Sub CreateRightClick2()". I have only added one command before. Any Help is Always Appreciated. Never mind. I got it and it works fine. |
Add Command to RightClick Menu
"Bob Phillips" wrote: I don't know why it didn't work. maybe there was an error in the runcode. Have you tried stepping through it? Does Remove already exist on the menu. You can add m ultiples like so Sub CreateRightClick() With Application.CommandBars("Cell") With .Controls.Add .Caption = "Remove" .OnAction = "Remove" End With With .Controls.Add .Caption = "Remove2" .OnAction = "Remove2" End With End With End Sub -- HTH ------- Bob Phillips "Ronbo" wrote in message ... I have a real simple routine that use to add a new command to the RightClick Menu. Sub CreateRightClick() With Application.CommandBars("Cell").Controls.Add .Caption = "Remove" .OnAction = "Remove" End With End Sub But for some reason, now it does not work. Nothing is add to the RightClick menu. What I want is "Remove" added to the menu and when clicked, for it to run the macro "Remove". Two, can I add other commands with "Sub CreateRightClick2()". I have only added one command before. Any Help is Always Appreciated. Thanks Bob. You are right it was a simple error in the code that I check over and over and did not find until after the post. However, I like and use your multiple commands. |
All times are GMT +1. The time now is 01:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com