Transfering data from VB.NET to Excel

montekass

Member
Joined
Jul 6, 2005
Messages
11
Programming Experience
Beginner
I am creating a program using a series of drop downs, I am looking to get the information after I have made all my selections, to transfer into excel for sorting and report printing. Any possible help and please I tried a few ways and no luck.
 
montekass said:
I am creating a program using a series of drop downs, I am looking to get the information after I have made all my selections, to transfer into excel for sorting and report printing. Any possible help and please I tried a few ways and no luck.

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. It worked for me :)
 
Last edited:
Now do I have to create a datagrid then transfer or will whatever my selections that I have made transfer to the descibed columns and rows?
 
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.
 
could I have a button labled done and when I click it the button it tranfers to a form, and when I am done lets say I need to go through the selection process 10 times to staore all the data in that done form, and then click transfer to excel button and have the information from the done form transfer to excel?
 
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 you need to reference.
 
Already included them when it debugs and get to the
dim excelBook as excel.workbook = excelapp.workbooks.add---I think this is the problem

In the example you sent I backspace and I can reselect, but in my program it says gettype, but I have referenced the excel 11.0 and the VBIDE, office, stdole, and ADODB.
 
Back
Top