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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:46:48+00:00 2026-06-11T04:46:48+00:00

Every time I see an example of office Automation using.NET, the language used is

  • 0

Every time I see an example of office Automation using.NET, the language used is VB.NET.

Is this because originally, automating Office apps like Excel could only be done using VB Script in a macro and the same people that wrote these macros naturally tend to gravitate to VB.NET or is there a reason not to use C# for Office Automation?

It appears as though I can instantiate the Excel class from C# the way I would use CreateObject from VB.NET.

excel = Type.GetTypeFromProgID("Excel.Application");

If you had to write a .NET program using Excel Automation, what language would you use and is there any reason to avoid C# other than maybe there are ore VB.NET examples?

Edit:

I was thinking of writing the code with an explicit reference to the Microsoft Excel Object library and explicit instantiation of an Excel class Application object and then, after the program is essentially tested, modifying the code to use late binding to allow the app to run with different versions of Excel.

Will the code be radically different?

For example, using early binding I can do this…

var excel2  = new Microsoft.Office.Interop.Excel.Application();
excel2.Visible = true;

In late biding, will I be forced to use radically different code like this?

excel = Type.GetTypeFromProgID("Excel.Application");
excel.InvokeMember("Visible", BindingFlags.SetProperty, null, excelObject, parameter);
  • 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-11T04:46:50+00:00Added an answer on June 11, 2026 at 4:46 am

    I’ve used both successfully, though there are more code examples available for VB.NET.

    One difference I can think of immediately is that the API methods seem to contain gajillions of optional method parameters, which don’t exist in C# < 4, so you’ll find yourself doing things like:

    object missing = Type.Missing;
    Excel.Application xl = new Excel.Application();
    xl.Workbooks.Open(fileName, 0, true, 5, "", "", true, 
                Excel.XlPlatform.xlWindows, missing, missing, missing, 
                missing, missing, missing, missing);
    

    Instead of just this in VB.NET:

    Dim xl As New Excel.Application()
    xl.Workbooks.Open(fileName, 0, True, 5, "", "", true, Excel.XlPlatform.xlWindows)
    

    Some of the syntactical sugar that VB.NET provides goes a long way with the conciseness of writing application that use the OLE Automation libraries or interop assemblies.

    EDIT: As for early- vs. late-binding, I can’t say that I have any experience with late-binding. This article talks about an approach to safely implement late-binding for multiple versions of an office application.

    A quote from the article:

    …you can start developing your add-in using interops for the highest version of the Office application. When this is done, you can replace early-binding calls to the features introduced in this Office version with late binding calls and make sure these calls work. Then you can replace the interop assemblies referenced by your project with the interop for a previous version of the application and reiterate the procedure. Kind of refactoring. Whether this approach is useful or not, this is you who decides

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

Sidebar

Related Questions

every time when I see a jQuery plugin like this: (function($) { $.fn.example =
Every time I come back the data to the user, I see that .NET
Every time i used the @inheritDoc tag in javadoc, I see the following warning
As far as I see every time I make a change, for example the
Every time i reset & seed my database it wipes out the standard admin@example.com
Every time I try to access my localhost/phpmyadmin it gives me this error --->
hi I'm trying create chat using node.js I see example in http://chat.nodejs.org/ I have
Every time I read about using synchronized in Scala the author will usually mention
I'm using JDOM with my Android project, and every time I get a certain
Do bubble sorts have any real world use? Every time I see one mentioned,

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.