Looking for .NET Excel Class

Posted on 2011-04-30
Last Modified: 2012-05-11
In the following article, Senthil S. uses the following code:


    With Excel
            .SheetsInNewWorkbook = 1

Open in new window

Unfortunately, he doesn't include a Dim statement for the Excel object.  My best guess is this:
        Dim Excel As Microsoft.Office.Interop.Excel.Workbook

Open in new window

Am I wrong?  Am I right?
Question by:jdana
    LVL 21

    Accepted Solution

    If you are using Microsoft Excel 12.0 Object Library this should be

    Dim Excel As Microsoft.Office.Interop.Excel.Application

    LVL 29

    Expert Comment

    by:Paul Jackson
    Should be :
    LVL 12

    Expert Comment

    He has this line earlier in the article
    Dim excel As New Microsoft.Office.Interop.Excel.ApplicationClass

    Open in new window

    LVL 83

    Assisted Solution

    Make sure you have installed the correct Office Primary Interop Assemblies and referenced the excel DLL in your project.

    Author Closing Comment

    Alfred nailed it.  (I'm running VS 2010 and "Embed Interop Types" set to TRUE.)

    Thanks all.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now