You need to include the references to the dll's that contain the "excel.application" object, like Interop.Excel and Interop.VBIDE... check the example code you may have downloaded from microsoft, you should click on the "references" tree in the solution explorer. There you will see the items...
Below is a link to some microsoft sample VB.NET code that can transfer contents of a datagrid to an excel spreadsheet:
Hopefully this can help you transfer your data to a spreadsheet...
I have a general question concerning scoping of code within an application.
I have written an application that consists of a main (parent) form with a toolbar that shows several additional (child) forms based on the value selected on the toolbar.
I have noticed that each of the...
Actually, garbage collection WAS the answer.
I had to force the garbage collection to occur in the closing handler of the form as follows:
After that bit of code, the occurrence of EXCEL.EXE is removed from memory.
OK, assuming you have a table in your schema named Customer, here is how you would list the columns for the customer table:
select column_name from INFORMATION_SCHEMA.COLUMNS
where table_name = 'Customer';
The results will look similar to this:
Hmmm... it STILL is leaving the process hanging out there when I close that specific form.
I KNOW I am executing the closing handler, but for some reason the process(s) still remains until the entire application shuts down.
If you make the excel application visible property = False, until you have finished loading the data, there is no way the user can see it.
As soon as you finish loading all your cells, make the excel app visible like this:
' view the spread sheet
objExcel.Visible = True
[RESOLVED] - Cleaning up memory after launching Excel from button
Here's my little problem:
Currently I am using a button on a windows form to transfer the contents of a datagrid into an Excel Spreadsheet and view the resulting sheet in Excel:
Each time the button is pressed during the same...