Problems using acustom control in a VBA form

S

sgailey

VB6.0 (SP3)
Windows XP

OK, it sounded simple to me at first. I'm trying to use a custom control
in a VBA form. I reduced the control to rule out any other application
errors to a label whose caption changes when clicked. I admit that I
don't have much experience with ActiveX controls, but VB makes it seem so
easy with the "File/NewProject/ActiveX Control": option. I have seem
several problems or Error using this control in VBA:

Error 459 "Object or Class does not support the set of events" or
"Object Not Found" or
"ObjectLibraryinvalid or contains references to object definitions
that could not be found"

I think I'm going crazy, I get the above errors at different times, but
can not see a pattern. I have maintained Binary compatibility with the
control, and have tried moving the OCX to a windows/system or
windows/system32 directory. Sometimes I run a new VBA project and
sometimes the saved project. I have recreated the OCX from scratch, but
have tried to unregistered, delete, compile, and replace the compatible
version of the OCX. I've done this before with ActiveX dll's that I've
created without any problems.

Now I can use this same control in a plan VB form without any
problems. Its seems to be something to do with VBA, either inside an
Office application or from IAPCIntegration inside my own VB app. Any
ideas? Thanks in advanced for any help.

I've included the test control code here:

Option Explicit
Private m_lstate As Long

Private Sub ClickLabel_Click()
If m_lstate = 0 Then
clicklabel.Caption = "Off"
m_lstate = 1
Else
clicklabel.Caption = "On"
m_lstate = 0
End If

End Sub

Private Sub ClickMain_InitProperties()
m_lstate = 0
End Sub
 
J

Jason Sharp

Honestly, it's been some time since I've worked on an
ActiveX cotrol, but heregoes:
- there are licensing issues regarding ActiveX controls,
these options are implemented by the designer. I figure
you probably know this.
- the sample code you have provided seems to indicate a
snippet from your activex dll module.
- However, it sounds like your errors are happening when
you try to use the control in an application.
- This maybe because you have not publicly exposed the
functional events of your control. Equally, this notion
applies to properties of your control.

Hope that helps,
Jason
 
E

email

Thanks for the response. I think the problem is somewhere else. I
noticed that regclean was not actually removing things from my registry.
It was leaving some old ID's for the objects that I was working on in the
registry. I think that is my main problem. I'll retract the question,
and start looking at the registry problems.
 

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