Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm running Office 2003, the code below causes Excel to crash. I tried to accomplish this with several workarounds but it still crashed Excel. Any ideas? It usually crashes at the "End With" statement filename1 = ThisWorkbook.Path & "\tempmoditerate.bas" filename2 = ThisWorkbook.Path & "\tempmodrunsfgcalcs.bas" filename3 = ThisWorkbook.Path & "\tempmodsfcalcs.bas" filename4 = ThisWorkbook.Path & "\menuxxx.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 | |||
Unlock/Lock VBProject through code? | Excel Programming | |||
Unlock/Lock VBProject through code? | Excel Programming | |||
Simple code crashes Excel | Excel Programming | |||
method vbproject of object workbook fail | Excel Programming | |||
Code in ThisWorkbook crashes Excel | Excel Programming |