Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:12:45+00:00 2026-06-07T17:12:45+00:00

I am posting this to elaborate on what are the options to run some

  • 0

I am posting this to elaborate on what are the options to run some C# functions (compiled) from VBA.

I have tried so far XLW and Excel DNA. Both of these enable you to build an .xll which you can reference from your Excel session to use (Excel DNA is better and easier. It is still supported also, whereas XLW hasn’t seen any update since .net 3 and requires VS2008 or 2005 with certain templates to run).

In my understanding, XLLs present a problem as they can’t be integrated into a spreadsheet and need to be separately loaded.

  1. Is there anyway to embed C# compiled code into a spreadsheet rather than Excel session to have VBA add ins working “standalone”/”out of the box”?
  2. Is it possible to load XLLs at runtime from VBA otherwise ? Are they any potential risks when doing so ?
  3. Any tips with regard to C#/VBA interop worth mentioning ?

Thank you !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:12:46+00:00Added an answer on June 7, 2026 at 5:12 pm

    One solution I’ve used in the past is to develop a VSTO 2005 .xls Document, convert it to an .xla, and use a technique similar to that described in this blog post from Paul Stubbs to get a reference to the COMVisible .NET code from VBA.

    My preferred solution is to:

    • Define the COM interfaces to be implemented in .NET in IDL, and build a type library from it.

    • Import this type library into a .NET project, and create concrete classes that implement the required interfaces.

    • Return a factory class instance to VBA using the technique described in the linked blog post. Once VBA has this factory class instance, it can use it to get at all of the API.

    By defining the COM interfaces manually using IDL, your VBA code will only need to reference these, rather than referencing typelibs generated from COM-visible .NET assemblies, which avoids a lot of versioning issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before posting this question, I have tried so many things but that was not
I have tried posting this earlier and had to delete it because the code
I am cross-posting this from scala-user: I have the following: object XmlTest { import
I'm posting this thread because I have some difficulties to deal with pictures in
Posting this one for a friend. They have an Icefaces app that uses Icefaces's
I have seen many posting this issue in SO. I have gone through those
I'm cross-posting this from the wordpress section, b/c I think the problem lies more
Note: I am cross-posting this from App Engine group because I got no answers
Tried posting this before but it did not go through (i think) so if
I have considered posting this question on GameDev since my case relates to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.