Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Event handler is invalid

Hello! Any ideas why I am getting this error?

I did add the Extensibility reference, and set Trust access to Visual Basic
Project. I also started over in a new workbook to make sure any previous
error did not corrupt anything.

Dim myLabel As MSForms.Label
Set myLabel = myForm.Controls.Add("Forms.Label.1", "Label1")

Dim myLine As Long

With ActiveWorkbook.VBProject.VBComponents("myForm").Co deModule
myLine = .CreateEventProc("Click", myLabel.Name) + 1
.InsertLines myLine, "MsgBox ""Hello!"""
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Event handler is invalid


Hello Minh,

Change *Dim myLine As Long* to *Dim myLine*. You are getting an error
because you are trying to assign a non nimeric value to a Long
Integer.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=491149

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Event handler is invalid

Thanks, Bob! Any help would be greatly appreciated!

Minh

"Bob Phillips" wrote:

I don't think that was the problem. The data type should be long as it
returns the line number. The problem seems to be that the control is not
known at that point. I'll see if I can make time to have a play today.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Minh" wrote in message
...
Hi Leith!

I appreciate the reply. However, I am still getting the error after I
modify the Dim statement. Any help would be appreciated.

Thanks!
minh

"Leith Ross" wrote:


Hello Minh,

Change *Dim myLine As Long* to *Dim myLine*. You are getting an error
because you are trying to assign a non nimeric value to a Long
Integer.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread:

http://www.excelforum.com/showthread...hreadid=491149





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
Event handler in a cell Man Utd Excel Programming 3 June 15th 05 07:44 AM
Global event handler?? [email protected] Excel Programming 1 October 23rd 04 05:31 PM
where is the workbook_open event handler??? Steff_DK[_10_] Excel Programming 2 April 25th 04 02:43 PM
different IDispatch in event handler Dirk[_2_] Excel Programming 0 January 23rd 04 11:04 PM
Cell Event Handler David Excel Programming 3 January 19th 04 04:51 PM


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

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

About Us

"It's about Microsoft Excel"