Consulting

Results 1 to 5 of 5

Thread: How to call .Net DLLs in Excel?

  1. #1

    Question How to call .Net DLLs in Excel?

    Hi all,
    I have DLL files which are having some logic related to Macros. I have created those DLLs by using Visual Studios. I want to use those DLLs files and I will perform some operations in macros.
    Could anyone help me please.
    Thanks
    Sankar

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can't say I have done it myself, but DLLs are DLLs are DLLs, so set a reference in the VBIDE to it, and you should be able to call any of its methods.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Depends on the DLL structure I suppose. Do what xld said after you have installed it using RegSvr32.

  4. #4
    Could you please let me know how to call the sub routines in DLLs.

    Suppose i have created one class module in the .Net with some sub routines in that class module and prepared class library file. & I have added that dll into my Excel. Could you please give sample code to call the sub routine in that DLL.
    Thanks
    Sankar

  5. #5
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You first have to register it as I detailed earlier. You can add the reference as xld detailed to use object.method.properties as any refence provided you set up the DLL properly. Another method is to use API methods but it depends on your functions and if you set them up as the standard Windows DLL's like user32.dll and such.

    Attach it if you like or post to a free shared site like 4shared.com, box.net or mediafire.com and we will look at it.

Posting Permissions

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