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);