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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:34:20+00:00 2026-06-09T15:34:20+00:00

I have an excel addin class that has this function: public void testRibbon() {

  • 0

I have an excel addin class that has this function:

public void testRibbon()
{
     Excel.Workbook workbook = this.Application.ActiveWorkbook;      
     Excel.Worksheet activeSheet = workbook.Sheets[1];
     Excel.Range range = activeSheet.get_Range(JOB_ID_FIELD + HEADER_ROW, TOTAL_STATUS_PERCENTAGE_KEY_FIELD + (10 + 1).ToString());
     range.get_Range("C4").Value = "test Ribbon complete";
}

In the ribbon I added a button that when pressed will call testRibbon in a thread:

private void process_Click(object sender, RibbonControlEventArgs e)
{
    Thread processThread = new Thread(delegate(){
        Globals.ExcelAddin.testRibbon();
    });
    processThread.Start();
} 

This causes a cast error:

Unable to cast COM object of type ‘System.__ComObject’ to interface
type ‘Microsoft.Office.Interop.Excel._Workbook’. This operation failed
because the QueryInterface call on the COM component for the interface
with IID ‘{000208DA-0000-0000-C000-000000000046}’ failed due to the
following error: Error loading type library/DLL. (Exception from
HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

The cast error doesn’t happen if I don’t use a new thread.

Edit:Tried using task factory, same error:

var task2 = Task.Factory.StartNew(
() =>
{
     Globals.BobStats.testRibbon();
});
  • 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-09T15:34:21+00:00Added an answer on June 9, 2026 at 3:34 pm

    Using multiple threads in Excel makes no sense because Excel’s COM interface is basically single threaded (see this article). There might be further restrictions from within an add-in.

    Yet I have to say I don’t really understand what the error message is trying to say.

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

Sidebar

Related Questions

I have a Excel addin that displays some structures on the worksheet. Users can
I have a VB6/VBA application that hooks into Excel and loads a workbook. It
We have an application that is built with Excel as the front end using
I have an Excel addin application which I developed with C# and I published
I have code that worked in the VSTO version of an Excel Addin Microsoft.Office.Tools.Excel.ListObject
I have an Excel VSTO AddIn that I moved up to Excel 2007/VS2010 last
I have Excel add-in which I add so many class modules that it is
I have on excel file that has the data of my student table. Now
I have c# code behind my Excel-dna addin which is successfully downloading data from
I have successfully used the Excel and Word addin templates in Visual studio 2008

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.