CreateEventProc runtime error '424

  • Thread starter Thread starter Neil
  • Start date Start date
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
 
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.
 
Dirk,

Thanks for the reply. I did step thru to identify this
call. I'm suspecting that there may be something strange
about my project and will try this in a new one to see if
I get the same behaviour. I'm wondering if there's
possibly a reference in VBA that I need to update/remove
too.

Cheers,
Neil
 
Dirk,

Turns out that it was the following line (insertlines)
that was at fault even though I could not step to it. I'll
remember this for future. Thanks for your help.

Neil
 
Back
Top