PDA

View Full Version : Short-cut menus from OWC.spreadsheet



Autofreak
02-04-2006, 11:08 AM
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 :friends: , 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 :banghead: 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,:bow:
Serge

Marcster
02-21-2006, 08:32 AM
Don't know weather you can add to the short-cut menus but you can over-ride the commands on it:


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


HTH,

Marcster.

Marcster
02-22-2006, 02:17 AM
BeforeContextMenu event is in Office 2003:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocevtBeforeContextMenu_HV03082982.asp

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

HTH,

Marcster.

Autofreak
02-23-2006, 05:33 PM
BeforeContextMenu event is in Office 2003:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocevtBeforeContextMenu_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!

Marcster
02-24-2006, 02:47 AM
I don't have OWC11 installed. Does this work?: :dunno
Add another menu item.

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



Marcster.

Autofreak
02-24-2006, 09:17 AM
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:clap: :clap: :clap:

Cheers,
Serge

Marcster
02-27-2006, 04:37 AM
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/default.asp?url=/library/en-us/dnowc/html/odc_ocwebcustmui.asp

Marcster.

Autofreak
03-03-2006, 11:59 AM
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