Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help.. Add an event to a sheet module

I am dying here...I am trying to add an event to a sheet module
I tested the code below which adds an open event to ThisWorkbook module
and works great. "The CodeModule object has a method called
CreateEventProc that you can use to create an event procedure in class
module, a sheet"
but i just cant figure how change the "ThisWorkbook" to a sheet moule

Dim StartLine As Long
With ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k").CodeModule
StartLine = .CreateEventProc("Open", "Workbook") + 1
.InsertLines StartLine, _
"Msgbox ""Hello World"",vbOkOnly"
End With



Reply
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
ByRef Cancel in event module Doug Glancy Excel Programming 4 July 10th 05 09:13 PM
Calls from sheet module to ThisWorkbook module quartz[_2_] Excel Programming 2 June 23rd 05 03:37 PM
Variable in event handles can't be used in module?? Jan Grinwis Excel Programming 1 February 25th 05 08:36 PM
Run module ON OPEN event?? MG Excel Programming 1 January 9th 04 12:31 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 11:18 AM.

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"