-
Jun 23rd, 2009, 01:26 PM
#1
Thread Starter
New Member
VBA - Active X Control
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.
-
Jun 23rd, 2009, 01:29 PM
#2
Re: VBA - Active X Control
Welcome to the forums.
Is this something that you created (the ocx)?
Do you know what the events are that you want to use?
-
Jun 23rd, 2009, 01:50 PM
#3
Thread Starter
New Member
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!
-
Jun 23rd, 2009, 01:59 PM
#4
Re: VBA - Active X Control
Where did you get the OCX from?
-
Jun 23rd, 2009, 02:09 PM
#5
Thread Starter
New Member
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
-
Jun 24th, 2009, 02:21 PM
#6
New Member
Re: VBA - Active X Control
-
Jun 30th, 2009, 12:50 PM
#7
Thread Starter
New Member
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?
-
Jul 14th, 2009, 06:32 PM
#8
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?
-
Jul 15th, 2009, 06:06 PM
#9
Thread Starter
New Member
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
-
Jul 16th, 2009, 08:31 AM
#10
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?
-
Jul 16th, 2009, 07:54 PM
#11
Thread Starter
New Member
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...
-
Jul 16th, 2009, 09:56 PM
#12
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.
-
Jul 17th, 2009, 07:04 AM
#13
Thread Starter
New Member
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.
PccAPI.zip
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!!
-
Jul 17th, 2009, 07:36 AM
#14
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.
-
Jul 17th, 2009, 12:47 PM
#15
Thread Starter
New Member
Re: VBA - Active X Control
understandable, thanks!! :-)
-
Jul 17th, 2009, 07:13 PM
#16
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|