Click to See Complete Forum and Search --> : VBA - Active X Control
spyter
Jun 23rd, 2009, 01:26 PM
I wasn't sure which forum this was supposed to be in, but I think this is the correct one. Here is my problem:
I am developing an excel application and I am trying to use a .ocx file as a reference. This ocx file has functions and events (since its an active X Object). In the VBA I am able to use the functions but I cannot get it to use the events. Does anyone have any ideas or advice?
thanks in advance!!
Let me know if you need any more details or want the .ocx file I am working with.
Hack
Jun 23rd, 2009, 01:29 PM
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?
spyter
Jun 23rd, 2009, 01:50 PM
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!
Hack
Jun 23rd, 2009, 01:59 PM
Where did you get the OCX from?
spyter
Jun 23rd, 2009, 02:09 PM
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
spyter smasher
Jun 24th, 2009, 02:21 PM
Check out this site for help: http://msdn.microsoft.com/en-us/library/aa188210(office.10).aspx
spyter
Jun 30th, 2009, 12:50 PM
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)
Dim WithEvents PccapiObj As PccAPILib.PccAPI
Public Sub Class_Initialize()
Set PccApiObj = new PccAPI 'this is where it errors out
End Sub
any advice?
LaVolpe
Jul 14th, 2009, 06:32 PM
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?
spyter
Jul 15th, 2009, 06:06 PM
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
LaVolpe
Jul 16th, 2009, 08:31 AM
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?
spyter
Jul 16th, 2009, 07:54 PM
to the best of my knowledge.. I can email you (or upload here) the file if you want me to...
LaVolpe
Jul 16th, 2009, 09:56 PM
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.
spyter
Jul 17th, 2009, 07:04 AM
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.
72025
Here is the URL for Entire Connection (if that helps):
http://www.softwareag.com/Corporate/products/natural/rela_3rd_prod/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!!
LaVolpe
Jul 17th, 2009, 07:36 AM
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.
spyter
Jul 17th, 2009, 12:47 PM
understandable, thanks!! :-)
LaVolpe
Jul 17th, 2009, 07:13 PM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.