You may find some useful code in C#/.NET below for Excel and .NET integration. You can easily translate the code from C# to VB.NET (visual basic) with a web-based service like this one.
The listed code examples below to address following problems:
- How to get the current Application instance of excel
- How to check if a certain Workbook corresponding to an application instance is already opened, and get the Workbook object
- How to get a Worksheet object of a given Workbook by sheet's name
- How to read an ListObject (excel table) into a DataTable (ADO.NET) object
- How to write (dump) a DataTable into a given worksheet efficiently
Some useful links for Excel-.NET integration:
- A Beginner’s Guide to calling a .NET Library from Excel
- Calling Table Functions in C#/.NET from Excel VBA
- Creating add-in for Excel using C#
- Creating Excel Add-in with VB.net or C#
- Walkthrough: Creating Your First Application-Level Add-in for Excel
Questions and comments are welcome.
Excel-related assemby references
1) Get the current application instance of excel
For the use of Globals class in Office projects (in Visual Sttudio) see also: Global Access to Objects in Office Projects
2) Get the workbook object by file path of the excel file
3) Get a worksheet object from the workbook by sheet's name
..where wb is the Workbook object.
4) Read a ListObject (excel table) into a DataTable object
Reading a strongly typed DataTable from excel range. MetaData object md contain field definitions.
5) Write (dump) a DataTable into a given worksheet efficiently