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 8840381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:27:09+00:00 2026-06-14T10:27:09+00:00

Can I generate COM visible assemblies (using CodeDom, or anything else) ? I am

  • 0

Can I generate COM visible assemblies (using CodeDom, or anything else) ?

I am looking to expose C# classes to VBA. Basically, I have an object-driven web server, and everytime I build my web server, I would like to also generate some wrapping classes (COM visible using CodeDom) as some clients will need these to access data from other contexts (Excel/VBA, etc…).

So is this possible at all ?

UPDATE:
Trying the RegFree approach of Snoopy, I build that class into test2.dll with CodeDom:

   namespace Test
   { 
       public class TestClass
       {
        private double _d1;
        private double _d2;

              public double d1 {
                get { 
                  return _d1; }
                set { _d1 = value; }
              }

           public double d2 {
            get { return _d2; }
            set { _d2 = value; }
           }

           public double sum()
           {
            return d1 + d2;
           }
       }
   }

I get the following in VBE:
enter image description here

  • 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-14T10:27:10+00:00Added an answer on June 14, 2026 at 10:27 am

    Yes, this is possible using Register Free COM.

    1)Open Excel and add the following references

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoree.tlb (Common Language Runtime Execution Engine 2.4 Library)

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\ mscorlib.tlb

    Add your Code Dom generated Classlibrary to the same directory where the Excel Sheet is stored

    3)use the following VBA Code:

    Sub Command1_Click()
         Dim clr As CorRuntimeHost
         Dim domain As AppDomain
         Dim objTest As Object
         Dim fltResult As String
    
         Set clr = New CorRuntimeHost
    
         clr.Start
         clr.GetDefaultDomain domain
         Set objTest = domain.CreateInstanceFrom("C:\Bla\YourGeneratedClassLibrary.dll", "NetComClassLibrary.Info").Unwrap
         fltResult = objTest.Version
         clr.Stop
    
         '//Debug.Print fltResult
         MsgBox fltResult
     End Sub
    

    More infos:
    http://blogs.msdn.com/b/junfeng/archive/2006/04/20/579748.aspx

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

Sidebar

Related Questions

I want to create an XSD which can generate the following XML. <note> <email:to>abc@def.com</email:to>
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
I know you can generate all permutations from a list, using glob or Algorithm::Permute
I have a .NET v2.0 Dll that exposes a few classes to COM. The
so I have a SWF file. It can generate Jpeg images. I want to
I'm using Ruby Rical to basically generate an icalendar as a response to an
I've started using poco templates so that I can generate the pocos for my
I am trying to implement http://baagoe.com/en/RandomMusings/javascript/Alea.js onto a website so I can generate better
I'm looking for a .NET library that can generate a clean Xml tree, ideally
I can't login to github with generated ssh-keys. I've followed this manual: http://help.github.com/linux-key-setup but

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.