Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
capture right mouse button click event on cell | Excel Programming | |||
Mouse Over Graph, Capture Information on Click(Double Click) | Excel Programming | |||
Sheet After Double Click event? | Excel Programming | |||
Before Double Click Event | Excel Programming | |||
capture shift-double-click | Excel Programming |