Consulting

Results 1 to 8 of 8

Thread: Short-cut menus from OWC.spreadsheet

  1. #1

    Short-cut menus from OWC.spreadsheet

    Hello Guys,
    it's my first post on this forum, used to work with Expert Exchange for some time, excellent source. Not so great when it comes to OWC 11 components though. Thanks to XL-Dennis and his articles , lit lots of light on the stuff. OWC.spreadsheet is really a great and interactive control and i would like to continue exploring it's capabilities.
    This time I am thinking of adding items to the short-cut menu and I was wondering if anybody has done any work in this direction and can give me a couple of tips and possibly even provide some code on programming short-cut menues for OWC.spreadsheet.

    Regards,
    Serge

  2. #2
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Don't know weather you can add to the short-cut menus but you can over-ride the commands on it:

    [VBA]
    Private Sub Spreadsheet1_BeforeCommand(ByVal EventInfo As OWC.SpreadsheetEventInfo)

    If EventInfo.Command = ssCopy Then
    MsgBox "Copy is not allowed."
    EventInfo.ReturnValue = False
    End If

    End Sub
    [/VBA]

    HTH,

    Marcster.

  3. #3
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    BeforeContextMenu event is in Office 2003:

    http://msdn.microsoft.com/library/de...HV03082982.asp

    This shows you how to program the short-cut menu.

    HTH,

    Marcster.

  4. #4
    Quote Originally Posted by Marcster
    BeforeContextMenu event is in Office 2003:

    http://msdn.microsoft.com/library/de...HV03082982.asp

    This shows you how to program the short-cut menu.

    HTH,

    Marcster.

    Excellent! so easy to use. Is there a way to not totally override the standard one but modify as necessary, use standard and add new items?

    Thank you very much Marster!

  5. #5
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    I don't have OWC11 installed. Does this work?:
    Add another menu item.
    [VBA]
    Sub Spreadsheet1_BeforeContextMenu(x, y, Menu, Cancel)

    Dim cmContextMenu(5)

    Dim cmContextMenu(6)
    Dim cmClearSubMenu(5)
    cmClearSubMenu(0) = Array("&All", "ClearAll")
    cmClearSubMenu(1) = Array("&Formats", "ClearFormats")
    cmClearSubMenu(2) = Array("&Values", "ClearValues")

    cmContextMenu(0) = Array("Cu&t", "owc2")
    cmContextMenu(1) = Array("&Copy", "owc3")
    cmContextMenu(2) = Array("&Paste", "owc4")
    cmContextMenu(3) = Empty
    cmContextMenu(4) = Array("Clea&r", cmClearSubMenu)
    cmContextMenu(5) = Array("MenuOption1", "MenuOption1Macro"
    Menu.Value = cmContextMenu


    End Sub

    sub MenuOption1Macro

    Msgbox "Menu Option 1 Called."

    End Sub
    [/VBA]


    Marcster.

  6. #6
    Hi Marcster,
    it works OK, I doesn't call Sub MenuOption1Macro as expected. And it overrides all the standard features like Cut, Paste, Delete. The world would be mush easier if I could be able to combine the standard and the custom functions on the menu

    Cheers,
    Serge

  7. #7
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hi Autofreak,
    I've found out that you need to place code that handles the custom menu entries in the CommandExecute Event.
    Read more here:
    http://msdn.microsoft.com/library/de...webcustmui.asp

    Marcster.

  8. #8
    Excellent Stuff Man,
    need to experiment around a little, if you happen to see any examples of what I am looking for please send the info.

    Regards,
    Serge

Posting Permissions

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