Results 1 to 2 of 2

adding another control to right click menu

Threaded View

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    adding another control to right click menu

    Hi Trying to work out the syntax for adding more than item to a right click menu - "Insert Date" appears correctly but how do I get "A Date" and "IN Date" to appear on menu as well??
    Private Sub Workbook_Open()
       On Error Resume Next
        Application.CommandBars("Cell").Controls("Insert Date").Delete
    
       Dim NewControl As CommandBarControl
       Set NewControl = Application.CommandBars("Cell").Controls.Add
       With NewControl
          .Caption = "Insert Date"
          .OnAction = "Module1.OpenCalendar"
          .BeginGroup = True
       End With
     
    
    End Sub
    When I try to add the others I cant get the syntax right

    Private Sub Workbook_Open()
       On Error Resume Next
        Application.CommandBars("Cell").Controls("Insert Date").Delete
        Application.CommandBars("Cell").Controls("A Date").Delete
        Application.CommandBars("Cell").Controls("IN Date").Delete
       Dim NewControl As CommandBarControl
       Set NewControl = Application.CommandBars("Cell").Controls.Add
       With NewControl
          .Caption = "Insert Date"
          .OnAction = "Module1.OpenCalendar"
          .BeginGroup = True
       End With
       Dim NewControl As CommandBarControl
          With NewControl = Application.CommandBars("Cell").Controls.Add
          .Caption = "A Date"
          .OnAction = "Module1.OpenCalendar1"
          .BeginGroup = True
       End With
       Dim NewControl As CommandBarControl
          With NewControl = Application.CommandBars("Cell").Controls.Add
          .Caption = "IN Date"
          .OnAction = "Module1.OpenCalendar2"
          .BeginGroup = True
       End With
    
    End Sub
    any help appreciated
    Last edited by nigelog; 09-06-2016 at 07:03 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Right Click menu in textbox control
    By threeaeabawys in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2014, 01:50 AM
  2. [SOLVED] Adding to Right-Click Context Menu
    By FlossHoss in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-06-2014, 10:02 AM
  3. Adding sum to right click menu
    By Monroe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2010, 05:19 PM
  4. Adding items to right-click menu
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-15-2006, 10:05 AM
  5. Adding items to a right click menu
    By Kezza in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2006, 04:55 AM
  6. Add control to right click menu when something is on the clipboard
    By Sean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2006, 04:35 AM
  7. [SOLVED] Adding a item to the right click menu?
    By silkworm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-24-2005, 01:28 AM

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