Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Shortcut Pupup Menu?

How can I add my own command to the shortcut popup menu in excel? I've
copied the exsample out of the help file and when I run the macro I get this
error message.
"Invalid procedure call or argument" the code is as follows

Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Custom"
Set ctrl1 = newMenu.Controls _
.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Import"
ctrl1.TooltipText = "Import"
ctrl1.Style = msoButtonCaption

The debuger stops at the "Ser newMenu =" line.
There must be an easy way. I just want to add my macro to the shortcut menu.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Shortcut Pupup Menu?

Ricky,

It worked for me, although it added it to my menu bar not the shortcut bar.
If you want the shortcut menu, try

Set myMenuBar = aplication.CommandBars("Cell")
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Custom"
Set ctrl1 = newMenu.Controls _
.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Import"
ctrl1.TooltipText = "Import"
ctrl1.Style = msoButtonCaption

but you also need to add an OnAction property to your button, else nothing
happens.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ricky S" wrote in message
...
How can I add my own command to the shortcut popup menu in excel? I've
copied the exsample out of the help file and when I run the macro I get

this
error message.
"Invalid procedure call or argument" the code is as follows

Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Custom"
Set ctrl1 = newMenu.Controls _
.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Import"
ctrl1.TooltipText = "Import"
ctrl1.Style = msoButtonCaption

The debuger stops at the "Ser newMenu =" line.
There must be an easy way. I just want to add my macro to the shortcut

menu.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Shortcut Pupup Menu?

See the post from earlier today:

Subject: Add Command to Right-Click Menu

Is this what you are looking for?


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
Popup Menu / Shortcut Menu Dale Fye Excel Discussion (Misc queries) 2 October 12th 07 12:57 AM
Shortcut menu help Art Excel Programming 14 August 16th 05 08:57 AM
shortcut menu Javed Excel Discussion (Misc queries) 1 December 6th 04 09:28 PM
shortcut for menu Douvid Excel Programming 1 July 28th 03 06:04 PM


All times are GMT +1. The time now is 09:51 PM.

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

About Us

"It's about Microsoft Excel"