Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I want to transfer some event procedures from one ThisWorkbook module to
another ThisWorkbook module, is it safe to do that. If it is, what is the best way to go about it. The code below sometimes causes Excel to crash, what am I doing wrong? Thanks filename1 = ThisWorkbook.Path & "\tempmoditerate.bas" filename2 = ThisWorkbook.Path & "\tempmodrunsfgcalcs.bas" filename3 = ThisWorkbook.Path & "\tempmodsfcalcs.bas" filename4 = ThisWorkbook.Path & "\tempmenu.bas" ThisWorkbook.VBProject.VBComponents("modIterate"). Export filename1 ThisWorkbook.VBProject.VBComponents("runsfgcalcs") .Export filename2 ThisWorkbook.VBProject.VBComponents("sfcalcs").Exp ort filename3 ThisWorkbook.VBProject.VBComponents("Thisworkbook" ).Export filename4 Set vbp = ActiveWorkbook.VBProject On Error Resume Next With vbp.VBComponents .Remove vbp.VBComponents("moditerate") .Import filename1 .Remove vbp.VBComponents("runsfgcalcs") .Import filename2 .Remove vbp.VBComponents("sfcalcs") .Import filename3 Lines = vbp.vbcomponents("thisworkbook").codemodule.counto flines vbp.vbcomponents("thisworkbook").codemodule.delete lines 1, Lines vbp.vbcomponents("thisworkbook").codemodule.addfro mfile filename4 vbp.vbcomponents("thisworkbook").codemodule.delete lines 1, 4 End With Kill filename1 Kill filename2 Kill filename3 Kill filename4 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run Event Code In General Module | Excel Programming | |||
Help.. Add an event to a sheet module | Excel Programming | |||
How to write a macro to import an event procedure to ThisWorbook? | Excel Programming | |||
ClearContents in event proc raises error | Excel Programming | |||
Run module ON OPEN event?? | Excel Programming |