+ Reply to Thread
Results 1 to 3 of 3

activeX dll

Hybrid View

  1. #1
    eRic
    Guest

    activeX dll

    I have build a dll by Visual basic
    How can I import the dll file on runtime ?



  2. #2
    moi
    Guest

    Re: activeX dll

    http://www.geocities.com/smplprgrsrc/files/DLL_DEMO.zip

    Very simple sample.
    Don't forget to add the dll to your references, that's also the trick in
    VBA.


    "eRic" <[email protected]> schreef in bericht
    news:[email protected]...
    >I have build a dll by Visual basic
    > How can I import the dll file on runtime ?
    >




  3. #3
    Rob Bovey
    Guest

    Re: activeX dll

    "eRic" <[email protected]> wrote in message
    news:[email protected]...
    >I have build a dll by Visual basic
    > How can I import the dll file on runtime ?


    I'm assuming your DLL contains at least one MultiUse or GlobalMultiUse
    class and that it's been properly registered on the machine where you want
    to use it. Otherwise you won't be able to access it from VBA. There are one
    of two ways to use an ActiveX DLL from VBA:

    1) Set a reference to the DLL using the Tools/References menu in the Visual
    Basic Editor. You can then declare object variables to represent objects in
    your DLL and otherwise use it exactly like you'd use any other class. You
    should always prefix any class names from your DLL with the name of the DLL
    itself to avoid any name collisions. For example, if you DLL is called MyDll
    and it has a public class called MyClass you would do this:

    Dim clsClassRef As MyDll.MyClass
    Set clsClassRef = New MyDll.MyClass
    ''' Use the clsClassRef variable here
    Set clsClassRef = Nothing

    2) You can use your DLL without a reference by using the late-binding
    technique. This requires you to declare all the variables that reference
    your DLL "As Object" and use the CreateObject function to acquire references
    for them. Using the same scenario as above, this would be:

    Dim objClassRef As Object
    Set objClassRef = CreateObject("MyDll.MyClass")
    ''' Use the objClassRef variable here
    Set objClassRef = Nothing

    --
    Rob Bovey, Excel MVP
    Application Professionals
    http://www.appspro.com/

    * Take your Excel development skills to the next level.
    * Professional Excel Development
    http://www.appspro.com/Books/Books.htm



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1