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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:02:29+00:00 2026-06-13T04:02:29+00:00

I have a problem, I want insert data with a button click method, but

  • 0

I have a problem, I want insert data with a button click method, but this method are created in a Ribbon menu (VSTO).

To understand better this, I want make a query on a database send it to a list of persons, and print on excel what i want see from that persons. For example, i just want see name and birthdate, or name, id and profession.

To do this i need select the Workbook opened when i run the application. So i try this:

private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            Excel.Workbook wb = (Excel.Workbook)Globals.ThisWorkbook.InnerObject;
            Excel.Worksheet ws = wb.Sheets["Sheet1"];
            ws.Cells[1, 2] = "teste";
        }
  • using Excel = Microsoft.Office.Tools.Excel;
  • using ExcelTools = Microsoft.Office.Tools;
  • using Microsoft.Office.Interop.Excel;

But i get this error:
**"Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Tools.Excel.Workbook'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B74CBB86-9C9F-4172-9AE7-3CE4A7BFA5EB}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."**

Probably is more easy than i’m seeing, but i’m so tired, and i need finish this…

  • 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-13T04:02:31+00:00Added an answer on June 13, 2026 at 4:02 am

    man try this:

    using Excel = Microsoft.Office.Interop.Excel;
    using Microsoft.Office.Tools.Excel;
    using Office = Microsoft.Office.Core;
    using Microsoft.VisualStudio.Tools.Applications.Runtime;
    Excel.Worksheet wsheet =
      (Excel.Worksheet)Globals.ThisAddIn.Application.ActiveSheet;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to insert some data to mydatabase.sqlite but I have a problem. There
I have a NSMutableArray , I want to insert data inside it, the problem
I have a problem that when we want to Insert a data into a
I have a problem if i want to insert this json test into my
I have this problem: I want to generate a new source code file from
I have a problem when I want to sending data using byte format in
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I want to place UItextField in UITableViewCell but I have problem. Text field don't
I have a little problem, what I need is to read data from this
I've got this problem.. it's soon not problem, but i want not to use

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.