G
George Doster
Excel 2000 on WinNT platform.
I'm trying to insert some code into a specific worksheet in a
workbook. The code is shown here:
Set VBCodeMod = ActiveWorkbook.VBProject.VBComponents(ActiveWorkbook.Worksheets("Images").CodeName).CodeModule
StartLine = VBCodeMod.CreateEventProc("Change", "Worksheet") + 1
VBCodeMod.InsertLines StartLine, "Msgbox ""Hello World"",vbOkOnly"
(sorry about the line break...)
Once the code executes the CreateEventProc line I get an error box
that says:
Run-time error '-2147417848(80010108):'
Automation error
The object invoked has disconnected from its clients.
Then Excel is hosed... have to quit and reopen.
The interesting part is if I try to insert some code into ThisWorkbook
everything works just fine. I've alse tried just using InsertLines
without a CreateEventProc call. Same effect. Any ideas???
I'm trying to insert some code into a specific worksheet in a
workbook. The code is shown here:
Set VBCodeMod = ActiveWorkbook.VBProject.VBComponents(ActiveWorkbook.Worksheets("Images").CodeName).CodeModule
StartLine = VBCodeMod.CreateEventProc("Change", "Worksheet") + 1
VBCodeMod.InsertLines StartLine, "Msgbox ""Hello World"",vbOkOnly"
(sorry about the line break...)
Once the code executes the CreateEventProc line I get an error box
that says:
Run-time error '-2147417848(80010108):'
Automation error
The object invoked has disconnected from its clients.
Then Excel is hosed... have to quit and reopen.
The interesting part is if I try to insert some code into ThisWorkbook
everything works just fine. I've alse tried just using InsertLines
without a CreateEventProc call. Same effect. Any ideas???