Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference a custom OCX in vba

Status
Not open for further replies.

HartwellTelecoms

Technical User
Aug 18, 2010
3
GB
Hi Guys,

Im trying to use VBA within Access to connect to the call centre and control a Telset.

I have been trying to search forums and have asked the questions before however not really got anywhere.

What I have done so far:

obtained the abcon32.ocx from Aspect and in Visual Basic for Application I went to Tools>References and added it

Tried to register it register it via opening a form, Tools>ActiveX Controls however said said it could not be added/deleted. Install/remove the control using a separate setup utility.

Im stuck at what to put for the code,

Function connect()
Dim abcon As abconlib.abcon
abcon.Host = "127.0.0.1"
abcon.PortType = 1
abcon.Port = 7000
If (abcon.OpenConnection = 0) Then
MsgBox "Success"
Else
MsgBox "Failure"
End If
End Function

It says "Object variable or With block variable not set"

Im guessing im not setting abcon correctly, anyone got any ideas? Example code of what you or ready have would be great so I could copy n paste and it should work (had an example before but was missing all the things it referenced)


From the object browser i get

Host As String
Member of AbconLib.Abcon

no help file though, only a API guide which has this for the property of HOST

Abcon.Host = "jupiter" ’CTI Server Host
 
>obtained the abcon32.ocx from Aspect

How did you obtain it?

>Tried to register it register it via opening a form

Ah ...

The ocx normally ships with its own installation program. The installation registers it properly and licences it. Without the license you cannot use the control
 
Anyway:
Dim abcon As [!]New[/!] abconlib.abcon

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, now I get a ActiveX component can't create object.

Strongm, Aspect is the company which supplied and owns the OCX, are you saying its not possible to use a OCX without it coming with a installation? Doesnt sound right to me but im not to clued up in this area.

Thanks

Ian
 
>are you saying its not possible to use a OCX without it coming with a installation?

Depends on the control, I'm afraid. You'll find, for example, that most of the controls that come with VB6 cannot be used in VBA applications (on machines without VB6)because the distributable control does not inlcude a design-time licence (although you'll get a relevant error message)

However, there a various ways of providing ActiveX licencing - you can use registry keys, .lic files, or a custom implementation (including custom error messages). All the information I have suggests that the abcon32.ocx requires installation using Aspect's installer if you expect it to work. Simple regisration won't cut it.

>>Doesnt sound right to me

Perhaps it doesn't. But it is. Here is a little enlightenment from MSDN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top