View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Changing RightClick event handling

How about just adding it to the bottom of that rightclick menu. Then they can
choose what they want.

This kind of thing might help:

Option Explicit
Sub auto_open()
With Application.CommandBars("cell")
On Error Resume Next
.Controls("DumpToFile").Delete
On Error GoTo 0

With .Controls.Add(Type:=msoControlButton, temporary:=True)
.BeginGroup = True
.Caption = "DumpToFile"
.OnAction = ThisWorkbook.Name & "!yourmacronamehere"
End With
End With
End Sub
Sub auto_close()
With Application.CommandBars("cell")
On Error Resume Next
.Controls("DumpToFile").Delete
On Error GoTo 0
End With
End Sub
Sub yourmacronamehere()
MsgBox "hi from your macro!"
End Sub


You could add some code into your macro that verifies that you're on the correct
worksheet of the correct workbook (or not!).



GeyserPeak wrote:

Hi,

I have a basic macro that is called from the right click event, which
disables the normal right click function and writes the text in the
right clicked cell out to a text file. I was hoping to build a user
button that would toggle between this mode and regular right click mode
while operating in the worksheet without having to go into the worksheet
code and change it, so I can go back and forth without going to the
editor. Is this possible?

Thanks,

--
GeyserPeak
------------------------------------------------------------------------
GeyserPeak's Profile: http://www.excelforum.com/member.php...o&userid=20746
View this thread: http://www.excelforum.com/showthread...hreadid=390439


--

Dave Peterson