LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Can you capture worksheet double click event from an Add-In????

Is there a way for me to add code to my add-in file that will capture
the before_doubleclick event of the worksheet that is referencing the
add-in? I currently have thousands of worksheets that are referencing a
single add-in and I need to add a new procedure that gets triggered
when a user double clicks on a specific sheet.

I have tried using the CreateEventProc (example 1) and the InsertLine
(example 2) technique to try to add the event procedure to the
activeworkbook. This has proved to be very unstable. It will work with
some worksheets and crash on others. From what I gathered from my
research, there is an issue with trying to add code to during run-time.

I was just wondering if there is a way that I can just add code to my
add-in that will get triggered when a user double clicks the worksheet.

Any help would be greatly appreciated.
James

Example 1
With ActiveWorkbook.VBProject.VBComponents("Sheet7").Co deModule
StartLine = .CreateEventProc("BeforeDoubleClick",
"Worksheet") + 1
.InsertLines StartLine, "PurchasePartsDblClick Target,
Cancel"
End With

Example 2
Sub AddDblClickEvent()
Dim myVBComp As VBIDE.VBComponent

Set myVBComp = ActiveWorkbook.VBProject.VBComponents("Sheet7")

myVBComp.CodeModule.InsertLines 1, "Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)"
myVBComp.CodeModule.InsertLines 2, "PurchasePartsDblClick Target,
Cancel"
myVBComp.CodeModule.InsertLines 3, "End Sub"
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
capture right mouse button click event on cell Reinhard Thomann Excel Programming 0 January 20th 05 11:41 AM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM
Sheet After Double Click event? Tom Ogilvy Excel Programming 0 July 27th 04 05:59 PM
Before Double Click Event gregork Excel Programming 4 February 9th 04 09:17 AM
capture shift-double-click Rob Bovey Excel Programming 0 July 13th 03 09:56 AM


All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"