Hi,
I'm trying to add a SheetBeforeDoubleClick event procedure to the ThisWorkbook module programatically, but when I try to call the CreateEventProc method, Excel crashes immediately. I have no idea what is causing this!
Here's my code:
Set vbCodeMod = wkbTemp.VBProject.VBComponents("ThisWorkbook").CodeModule
With vbCodeMod
' It crashes on the next line
intStart = .CreateEventProc("SheetBeforeDoubleClick", "Workbook") + 1
.InsertLines intStart, "If Not(Double_Click(sh, target, cancel)) Then MsgBox(""Error"")"
End With
All ideas gratefully received!
I'm trying to add a SheetBeforeDoubleClick event procedure to the ThisWorkbook module programatically, but when I try to call the CreateEventProc method, Excel crashes immediately. I have no idea what is causing this!
Here's my code:
Set vbCodeMod = wkbTemp.VBProject.VBComponents("ThisWorkbook").CodeModule
With vbCodeMod
' It crashes on the next line
intStart = .CreateEventProc("SheetBeforeDoubleClick", "Workbook") + 1
.InsertLines intStart, "If Not(Double_Click(sh, target, cancel)) Then MsgBox(""Error"")"
End With
All ideas gratefully received!