+ Reply to Thread
Results 1 to 3 of 3

Shortcut Pupup Menu?

  1. #1
    Ricky S
    Guest

    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. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Andy
    Guest

    Re: Shortcut Pupup Menu?

    See the post from earlier today:

    Subject: Add Command to Right-Click Menu

    Is this what you are looking for?



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1