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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:49:21+00:00 2026-05-27T00:49:21+00:00

I am converting several VBA projects to Windows form applications. The only problem I

  • 0

I am converting several VBA projects to Windows form applications. The only problem I have is that some of the functionality of Excel is essential to the application, such as R1C1 formulas. I do not want to instantiate the Excel application or access saved worksheets. All of the data is retrieved by querying Oracle databases. 2-Dimensional arrays are not an option because the columns contain differing datatypes, and DataGridViews are too slow to work with.

I thought simply dimming a Microsoft.Office.Interop.Excel.Worksheet object would be enough, but the program kept failing and upon inspecting the object’s elements in debug mode, I found that every value says this:

{“Unable to cast COM object of type ‘Microsoft.Office.Interop.Excel.WorksheetClass’ to interface type ‘Microsoft.Office.Interop.Excel._Worksheet’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D8-0000-0000-C000-000000000046}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).”}

I would really appreciate the help if someone is able to tell me how to get a worksheet object without opening Excel, or at least offer a reasonable alternative.

  • 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-27T00:49:21+00:00Added an answer on May 27, 2026 at 12:49 am

    You probably need to instantinate your object correctly. Worksheet requires Excel COM object, so you normally instantinate its first and then access a sheet. Here is some sample code:

    Dim xl As Microsoft.Office.Interop.Excel.Application
    xl = New Microsoft.Office.Interop.Excel.Application
    Dim wb As Microsoft.Office.Interop.Excel.Workbook
    wb = xl.Workbooks.Add()
    Dim ws As Microsoft.Office.Interop.Excel.Worksheet
    ws = wb.ActiveSheet
    

    Now you can work with your ws. Notice, that I do not instantinate it using Dim .. as New.

    By doing this you will get an invisible instance of Excel running in your background. You must close your application explicitly after you are done to prevent it from staying in memory:

    /// after your are finished
    xl.Quit()
    Marshal.ReleaseComObject(xl)
    

    This is especially important if you using it in a kind of loop.

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

Sidebar

Related Questions

We are upgrading/converting several old Access databases to MS-SQL. Many of these databases have
I have been tasked with converting several php classes into java classes, which is
I need a little help converting some VB.NET code to C#. I have tried
I had a class that only worked in Delphi 7 and after several attempts
I have several hex-values that I try to write to a file. It seems
I have several MS Access queries (in views and stored procedures) that I am
I have several old 3.5in floppy disks that I would like to backup. My
I've got several large MFC applications here, and converting them into any other format
I have a canvas that has a bitmap image of a document and several
I have several expressions I have generated in Mathematica that I would like to

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.