Re: VBA - Active X Control
Welcome to the forums. :wave:
Is this something that you created (the ocx)?
Do you know what the events are that you want to use?
Re: VBA - Active X Control
No this file is not one that I programmed. It is an API file for another application that I am trying to control in VBA. I can see the functions and events in the object browser tho. Do you need a copy of the file to see what I mean?
thanks!
Re: VBA - Active X Control
Where did you get the OCX from?
Re: VBA - Active X Control
The .OCX file was installed with the software we use (AG Entire Connection). It's a remote terminal emulation software. This .OCX file has functions that we need to be able to control the terminal emulation software programmatically so we can use it to scrape information from the terminal. When I reference the OCX file it shows up in my object browser and has a list of all the functions and events in it. I can use the functions in my VBA code but it doesnt recognize the events.
thanks
Re: VBA - Active X Control
Re: VBA - Active X Control
haha funny name - nice link tho :-)
I have a class in my VBA code and I am trying to use this OCX file but i get an error when the object is set (RunTime Error 429 - ActiveX component can't create object)
Code:
Dim WithEvents PccapiObj As PccAPILib.PccAPI
Public Sub Class_Initialize()
Set PccApiObj = new PccAPI 'this is where it errors out
End Sub
any advice?
Re: VBA - Active X Control
When you type: Set PccApiObj = New
In the intellisense dropdown, does PccAPI show up?
Not all classes can be created. Classes can be categorized as Public-Not Creatable. This means you can reference the class if it is exposed by the control, but you can't create a new object.
Also, how are you declaring it when you are able to use the functions? With the New keyword? Can you show us?
Re: VBA - Active X Control
yes, it shows up and I can instantiate the class object and can use the functions/subs in it but I cannot access its events
thanks
Re: VBA - Active X Control
In your class, if you click the top left dropdown box, do you see PccapiObj in the combobox? If so, and you click on it, are there any events in the right top combobox?
The events you are trying to trap, are you 100% positive they are events for the PccAPI class or are they from a control or another class within the PccAPILib?
Do you have VB6? If so, do you get the same problem if you try to do this in VB6? Maybe this is a VBA issue?
Re: VBA - Active X Control
to the best of my knowledge.. I can email you (or upload here) the file if you want me to...
Re: VBA - Active X Control
If you don't mind sharing, add it to a zip and rar if possible. I and others may be willing to download it, register it, and see what we can do.
Additionally, when you post the zip, please include some more details, specifically what events you are trying to trap and anything else we may need to know to quickly apply that lib to look at it and get a feel for it.
1 Attachment(s)
Re: VBA - Active X Control
Attached is the .ocx file. Basically, I have a terminal emulator (Entire Connection) and this .ocx file is supposed to allow me to use API's to control Entire Connection programmatically. The functions/subs in this .ocx file work fine, but I need to use the events as well so I can detect when requests have completed. We are trying to use this .ocx file to screen scrape from the remote TN3270. For instance, if the screen changes, or if i try to set the cursor coordinates on the screen, these all fire events and I need to be able to utilize these events to efficiently program.
Attachment 72025
Here is the URL for Entire Connection (if that helps):
http://www.softwareag.com/Corporate/.../term_emul.asp
Thanks again for all your help up to this point, I greatly appreciate it!!! :-)
**if you need anything else or more details on anything, please let me know!!
Re: VBA - Active X Control
I will look at this later tonight or tomorrow AM. At work and not allowed to download/install "unauthorized" ocx's on the company PCs.
Re: VBA - Active X Control
understandable, thanks!! :-)
Re: VBA - Active X Control
Hmmm, sorry I am of no help. I can't get it to work at all (VB6 or VBA). I wonder if possibly one of the following are in effect:
1. The ocx needs other ocxs or dlls that don't exist or are the wrong versions on our pcs.
2. The ocx needs to be installed with a setup.exe (from the company). The setup.exe may contain additional files (including a license file of some sort maybe) that would allow the active-x object to be created without errors.
3. The company link indicates compatible protocols and other info, is it possible the ocx recognizes that what it is compatible with is not on the system and errors; thus preventing the ocx from being created?
The above questions are more for thought than actual questions. BTW. If I try to register the ocx, I get an error.