Results 1 to 4 of 4

Thread: Add Control To Right-Click Cell Context Menu

  1. #1
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14

    Add Control To Right-Click Cell Context Menu

    Excel Fox
    Down loaded your calendar - thanks - how did you add the Calendar choice when you right_click on a cell _ I posted that question on MrExcel - never got any answers - can you show that piece of code?

    Thanks
    xl2007 - Windows 7
    xl hates the 255 number

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Here's the code Rasm

    Code:
    Private Sub AddOnRightClick()
        On Error Resume Next
     
        Dim cbrButton As CommandBarButton
     
        With Application
            .CommandBars("Cell").Controls("Calendar").Delete
            Set cbrButton = .CommandBars("Cell").Controls.Add(Temporary:=True, Before:=1)
        End With
     
        With cbrButton
           .BeginGroup = True
           .Style = msoButtonIconAndCaption
           .Caption = "Calendar"
           .FaceId = 125
           .OnAction = "ShowCalendar"
        End With
     
        Set cbrButton = Nothing
     
        On Error GoTo 0
    End Sub
    Code:
    Private Sub DeleteOnRightClick()
        On Error Resume Next
     
        With Application
            .CommandBars("Cell").Controls("Calendar").Delete
        End With
     
        On Error GoTo 0
     
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14
    Cool - this works nicely - sweet.
    xl2007 - Windows 7
    xl hates the 255 number

  4. #4
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14
    Here is a link to a bunch of different .FaceId values.

    http://www.outlookexchange.com/artic...InOLKIcons.asp
    xl2007 - Windows 7
    xl hates the 255 number

Similar Threads

  1. Add Macros To Custom Menu
    By mfaisalrazzak in forum Excel Ribbon and Add-Ins
    Replies: 2
    Last Post: 03-01-2013, 04:23 PM
  2. Double click can edition in ListView
    By marreco in forum Excel Help
    Replies: 1
    Last Post: 02-18-2013, 10:09 PM
  3. Click Run cycle
    By PcMax in forum Excel Help
    Replies: 6
    Last Post: 11-01-2011, 04:50 AM
  4. How To Add Menu And Buttons To Ribbon Group
    By Excel Fox in forum Excel Ribbon and Add-Ins
    Replies: 1
    Last Post: 07-04-2011, 12:43 PM
  5. Add Control to List On Right-Click
    By Rasm in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 04-17-2011, 08:16 PM

Tags for this Thread

Posting Permissions

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