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

  • Home
  • SEARCH
  • 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 752711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:48:47+00:00 2026-05-14T14:48:47+00:00

I have a simple class library that I use in Excel. Here is a

  • 0

I have a simple class library that I use in Excel. Here is a simplification of my class…

using System;
using System.Runtime.InteropServices;

namespace SimpleLibrary
{
 [ComVisible(true)]
 public interface ISixGenerator
 {
  int Six();
 }

 public class SixGenerator : ISixGenerator
 {
  public int Six() 
  {
   return 6; 
  }
 }
}

In Excel 2007 I would create a macro enabled workbook and add a module with the following code:

Public Function GetSix()
    Dim lib As SimpleLibrary.SixGenerator
    lib = New SimpleLibrary.SixGenerator
    Six = lib.Six
End Function

Then in Excel I could call the function GetSix() and it would return six. This no longer works in Excel 2010 64bit. I get a Run-time error ‘429’: ActiveX component can’t create object.

I tried changing the platform target to x64 instead of Any CPU but then my code wouldn’t compile unless I unchecked the Register for COM interop option, doing so makes it so my macro enable workbook cannot see SimpleLibrary.dll as it is no longer regsitered.

Any ideas how I can use my library with Excel 2010 64 bit?

  • 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-05-14T14:48:47+00:00Added an answer on May 14, 2026 at 2:48 pm

    You haven’t described in detail how your created your .NET assembly. However, there are a certain number of steps required to expose the assembly to COM:

    • Add the following attributes to your code:

      using System;
      using System.Runtime.InteropServices;
      
      namespace SimpleLibrary
      {
          [ComVisible(true)]
          [Guid("71F645D0-AA78-4447-BA26-3A2443FDA691")]
          public interface ISixGenerator
          {
              int Six();
          }
      
          [ComVisible(true)]
          [ProgId("SimpleLibrary.SixGenerator")]
          [Guid("8D59E0F6-4AE3-4A6C-A4D9-DFE06EC5A514")]
          [ClassInterface(ClassInterfaceType.AutoDispatch)]
          public class SixGenerator : ISixGenerator
          {
              [DispId(1)]
              public int Six()
              {
                  return 6;
              }
          }
      }        
      
    • Your assembly must be signed (Project -> Properties… -> Signing, create a strong key file and check the box to sign the assembly

    • The following command is necessary to register the assembly (all in one line):

      C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe 
                        SimpleLibrary.dll /tlb SimpleLibrary.tlb /codebase
      

      This creates a .tlb type library file which you will have to reference from your VBA project (Tools -> References -> Browse… in your VBA editor)

    • Adjust the VBA code:

      Public Function GetSix()
          Dim lib As SimpleLibrary.SixGenerator
          Set lib = New SimpleLibrary.SixGenerator
          GetSix = lib.Six
      End Function
      

    You will find the steps described in more detail in this article on Microsoft’s support database:

    How to call a Visual Basic .NET or Visual Basic 2005 assembly from Visual Basic 6.0

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

Sidebar

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.