Does VBA code could use dll active X?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Does VBA code could use dll active X?

  1. #1
    bigbag Guest

    Does VBA code could use dll active X?


    Hi,

    I use a dll active X that I have coded.
    This dll active X used to work very fine with VB application.
    I use VB6, office 2000 on NT 4.0 workstation platform SP5

    When I want to use my dll activeX with a simple vba :
    - I register the dll with regsvr32 on the computer
    - I try to use my vba code with Excel: the result is that the object from
    the dll haven't been find
    by the vba interpreter code. In the references part (tools\references in
    vba), the dll active x is referenced
    as MISSING; but the name and path as indicated are the good ones ...

    the solution I use is :
    - i browse to find my dll for the references of vba for execl and it works
    good.
    But I can not do that for 50 users ...

    My question is: how can I use and active x dll with vba macro for office
    2000 without manualy
    reference it (does it exists an automatic/programmatic way to reference it
    in VBA code)?

    thanks for the help.

    jerome

  2. #2
    Srinivas T. Guest

    Re: Does VBA code could use dll active X?


    Hi,

    Please see Microsoft Documentation on RegMyServerObject
    before you proceed.

    There is a programmatic way of registering an Active X dll.

    Try some thing like this.

    ' Function which registers a component on a system
    '
    Public Declare Function RegMyServerObject Lib _
    "Path:\Dll.name" Alias "DllRegisterServer" () As Long

    Try registering the component through the following call
    in workbook_open event or something like that.

    ' Register the component for furthur use.
    '
    RegMyServerObject

    But when you instantiate an object from the component ,
    it has to be a late bound.

    Try it and let me know.

    - Srini.

    "bigbag" <jgransac@be-partner.com> wrote:
    >
    >Hi,
    >
    >I use a dll active X that I have coded.
    >This dll active X used to work very fine with VB application.
    >I use VB6, office 2000 on NT 4.0 workstation platform SP5
    >
    >When I want to use my dll activeX with a simple vba :
    >- I register the dll with regsvr32 on the computer
    >- I try to use my vba code with Excel: the result is that the object from
    >the dll haven't been find
    >by the vba interpreter code. In the references part (tools\references in
    >vba), the dll active x is referenced
    >as MISSING; but the name and path as indicated are the good ones ...
    >
    >the solution I use is :
    >- i browse to find my dll for the references of vba for execl and it works
    >good.
    >But I can not do that for 50 users ...
    >
    >My question is: how can I use and active x dll with vba macro for office
    >2000 without manualy
    >reference it (does it exists an automatic/programmatic way to reference

    it
    >in VBA code)?
    >
    >thanks for the help.
    >
    >jerome



  3. #3
    Paul Clement Guest

    Re: Does VBA code could use dll active X?

    "bigbag" <jgransac@be-partner.com> wrote:


    Hi,

    I use a dll active X that I have coded.
    This dll active X used to work very fine with VB application.
    I use VB6, office 2000 on NT 4.0 workstation platform SP5

    When I want to use my dll activeX with a simple vba :
    - I register the dll with regsvr32 on the computer
    - I try to use my vba code with Excel: the result is that the object from
    the dll haven't been find
    by the vba interpreter code. In the references part (tools\references in
    vba), the dll active x is referenced
    as MISSING; but the name and path as indicated are the good ones ...

    the solution I use is :
    - i browse to find my dll for the references of vba for execl and it works
    good.
    But I can not do that for 50 users ...

    My question is: how can I use and active x dll with vba macro for office
    2000 without manualy
    reference it (does it exists an automatic/programmatic way to reference it
    in VBA code)?

    I think the problem is one of binary compatibility. The Excel Workbook
    application is expecting a version with a specific CLSID (Class ID). When you
    modified (by changing properties, methods, or enums) and re compiled your
    component (in Visual Basic) you probably broke binary compatibility which
    changed the interface. Now your project is looking for a component with an
    interface that no longer exists since you have overwritten it with the changed
    version.

    In order to resolve this problem, you will need to uncheck the "missing"
    reference in the Excel project and locate the new version in the References
    dialog and select it instead, or you will have to go back to the previous
    version of the component and make modifications without breaking binary
    compatibility.

    Here is some information concerning binary compatibility:

    http://msdn.microsoft.com/library/de...ryversions.htm


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center