CreateEventProc runtime error '424

N

Neil

Any help would be appreciated...

I've just created a form in VBA and want to add events for
controls.
When I follow the example in the help for this function I
get an error
from MS VB "Run-time error '424': Object Required" at the
point where
the event proc function is called.

After clicking "End" (Continue/Debug grayed out) and look
at the form's
module, I see the code for the event sub with no content
(to be inserted
on the next line of code if it ever got there). I've
checked the
arguments to the procedure and all is OK (must be anyway,
as the sub was
created correctly/as expected).

Has anyone seen this error for this function? If so, what
did you do to
correct it? If not, any idea what may be going on? Here's
my code if it
helps...

With CreateControl(frm.Name, lngType, , , , lngX +
lngXOff, lngY + lngYOff, lngWidth, clngHeight)
.Name = strControlName & lngLine
'' Works fine, I see the control on the Form

'' Never gets here
' Add event to call Update function
lngFileLineNumber = frm.Module.CreateEventProc
("Click", .Name) '' Error occurs here

'' Never gets here
' Insert text into body of procedure.
'
End With


Many thanks,
Neil
 
D

Dirk Goldgar

Neil said:
Any help would be appreciated...

I've just created a form in VBA and want to add events for
controls.
When I follow the example in the help for this function I
get an error
from MS VB "Run-time error '424': Object Required" at the
point where
the event proc function is called.

After clicking "End" (Continue/Debug grayed out) and look
at the form's
module, I see the code for the event sub with no content
(to be inserted
on the next line of code if it ever got there). I've
checked the
arguments to the procedure and all is OK (must be anyway,
as the sub was
created correctly/as expected).

Has anyone seen this error for this function? If so, what
did you do to
correct it? If not, any idea what may be going on? Here's
my code if it
helps...

With CreateControl(frm.Name, lngType, , , , lngX +
lngXOff, lngY + lngYOff, lngWidth, clngHeight)
.Name = strControlName & lngLine
'' Works fine, I see the control on the Form

'' Never gets here
' Add event to call Update function
lngFileLineNumber = frm.Module.CreateEventProc
("Click", .Name) '' Error occurs here

'' Never gets here
' Insert text into body of procedure.
'
End With


Many thanks,
Neil

I haven't actually done this before, but I've tested the code snippet
you posted and it works fine for me, so far as it goes. Are you sure
that it's failing at the point you think it's failing? If you step
through the code line by line, you should be able to positively identify
the exact line that is causing the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top