VBA - Active X Control-VBForums
Results 1 to 16 of 16

Thread: VBA - Active X Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    Exclamation 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.

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    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?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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!

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: VBA - Active X Control

    Where did you get the OCX from?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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

  6. #6
    New Member
    Join Date
    Jun 2009
    Posts
    1

    Exclamation Re: VBA - Active X Control


  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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?

  8. #8
    VBaholic & Loving It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    GetWindowRect()
    Posts
    12,432

    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?
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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

  10. #10
    VBaholic & Loving It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    GetWindowRect()
    Posts
    12,432

    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?
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #11

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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...

  12. #12
    VBaholic & Loving It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    GetWindowRect()
    Posts
    12,432

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    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!!

  14. #14
    VBaholic & Loving It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    GetWindowRect()
    Posts
    12,432

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  15. #15

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    8

    Re: VBA - Active X Control

    understandable, thanks!! :-)

  16. #16
    VBaholic & Loving It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    GetWindowRect()
    Posts
    12,432

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.