Can I make a dot net dll in visual studio (using visual basic) and have Excel call its methods?

Gideon Maven 21 Reputation points
2020-09-14T17:51:43.29+00:00

I would like to create a dll using visual basic dot net, and then call its methods/functions from Excel's VBA. That way, Excel can pass data to my dll, and obtain a vector of answers. Can this be done?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,442 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,346 questions
{count} votes

Accepted answer
  1. RLWA32 28,661 Reputation points
    2020-09-14T18:26:58.047+00:00

    If I remember correctly VBA cannot directly call into a class library created by VB.Net (managed code dll). However, you can use VB.Net to create a dll that hosts a COM object. VBA would be able to instantiate that COM object and use its methods and properties.


1 additional answer

Sort by: Most helpful
  1. Emi Zhang-MSFT 10,616 Reputation points Microsoft Employee
    2020-09-15T08:21:11.203+00:00

    Hi @Gideon Maven ,
    Based on your description, I suggest you post this issue to Excel for Developer forum:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments