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...
Well, the construct used in the example is a datagrid, but you could transfer from any structure, provided you can refer to your data one "cell" at a time.
Below is a link to some microsoft sample VB.NET code that can transfer contents of a datagrid to an excel spreadsheet:
http://www.microsoft.com/downloads/details.aspx?familyid=BF799731-D4C4-4716-ABD6-74A11BB85C9F&displaylang=en
Hopefully this can help you transfer your data to a spreadsheet...
Hi all:
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:
GC.Collect()
GC.WaitForPendingFinalizers()
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:
column_name
-------------
cid
custid...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.