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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:47:15+00:00 2026-05-13T17:47:15+00:00

I am developing an add-in for Microsoft Excel, using Visual Studio .NET 2008. The

  • 0

I am developing an add-in for Microsoft Excel, using Visual Studio .NET 2008.

The add-in creates a single toolbar button, which can be clicked to launch a form, which can be used to add values from a database into the cells of the active spreadsheet.

1) A requirement is that the tool be available in both Excel 2003 and in 2007.

2) Another requirement is that, in Excel 2007, the launch button be on its own ribbon tab.

Because of the ribbon tab requirement, I have created two separate Excel add-in projects within Visual Studio – one for each version of office.

However, because the two add-ins must reference two different Office.Interop assemblies, and the project providing the database query form can only reference one, I find myself unable to share this third assembly between the two add-in projects.

Does anybody have a simpler solution than maintaining a separate copy of the form code for each of the two add-in versions?

Thanks.

  • 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-13T17:47:16+00:00Added an answer on May 13, 2026 at 5:47 pm

    There are two options:

    Option 1: Don’t reference any Interop assemblies in the shared project providing the database query. Use interfaces and dependency injection to provide the required Excel interoperability code from the add-in projects.

    Let me give you an example: Assume that your shared project needs to execute some function func which needs access to the Interop libraries. You could create an interface in your shared project:

    public interface ExcelInterface {
        void func();
    } 
    

    In your add-in projects, your provide implementations for this interface:

    class Excel2003Interface : ExcelInterface { // located in your Excel 2003 Addin
        void func() {
            // the code here can use the Excel 2003 interop reference
        }
    }
    

    Similarly, you create Excel2007Interface in your Excel 2007 addin.

    Then, when opening the form in the shared project, you pass an instance of either Excel2003Interface or Excel2007Interface, which is used by the form to call func:

    void DoSomething(ExcelInterface iface) {  // this is in your shared project
        ...
        iface.func();
        ...
    }
    

    Option 2: Use the litte-known link file feature of Visual Studio to share code between the two add-in projects.

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

Sidebar

Ask A Question

Stats

  • Questions 382k
  • Answers 382k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I ended up using only a single tap and a… May 14, 2026 at 10:34 pm
  • Editorial Team
    Editorial Team added an answer With your example, there is no need to have a… May 14, 2026 at 10:34 pm
  • Editorial Team
    Editorial Team added an answer Found a solution. This works. $('table tr').live('click', function (event) {… May 14, 2026 at 10:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.