LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using CreateEventProc fails when used with a Worksheet.

Excel 2000 on WinNT platform.

I'm trying to insert some code into a specific worksheet in a
workbook. The code is shown he

Set VBCodeMod = ActiveWorkbook.VBProject.VBComponents(ActiveWorkbo ok.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???
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link to other worksheet fails. Warren Easton Excel Discussion (Misc queries) 3 January 15th 09 11:10 PM
reference to worksheet fails if row deleted GISJane Excel Worksheet Functions 7 October 10th 08 09:56 PM
Hyperlink to renamed Worksheet fails KIM W Excel Discussion (Misc queries) 2 August 7th 08 06:33 PM
Worksheet fails to filter at times John Excel Worksheet Functions 0 October 12th 07 07:58 AM
Macro fails when worksheet protected George Tattam Excel Discussion (Misc queries) 5 February 9th 06 11:07 PM


All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"