Results 1 to 5 of 5

Thread: Calling .NET DLL from an Excel Macro??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29

    Calling .NET DLL from an Excel Macro??

    I have a DLL that was developed under the .NET framework. It is a mathematical model used to calculate some returns. Anyways I need the ability to call the functions from within an Excel macro... The inputs for the model will come from the excel spreadsheet. The problem is I went to VB editor -> Tools -> references -> browse... then I attempt to open the .NET .DLL.... then I get the error message "Can't add reference to the specified file." If you have any experience with VBA and calling .NET DLLs any advice would be very helpful.

    Thanks,
    brazilnut

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You would have to convert the DLL to be COM compatible and then you can make a reference to it from within VBA. To learn how to make the DLL COM compatible please search on that topic and you should find plenty of resources. Try searching for COMInterop.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29
    thanks for the help!... I will do that.

    brazilnut

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29
    I have tried searching for COM Interop... but the only thing I have found involves making COM libraries compatible with .NET, not the other way around. I am simply trying to call a function in a .NET DLL from a VBA marco in Excel 2000. Any ideas?

    brazilnut

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    In the Help files for Visual Studio try searching using 'COM Interop' and you should find an article titled 'Walkthrough: Creating COM Objects with Visual Basic .NET' or you could probably even search for the title of the article to find it. It is a walkthru of how to make a COM object in VB.NET and should be exactly what you are looking for.

Posting Permissions

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



Click Here to Expand Forum to Full Width