[RESOLVED] Inserting data from VB into Excel.??? Need help!
Hi!
I'm trying to find an easy way to export data from my database using VB.
I already managed to write some textbox values into excel, but since this takes a lot of time and is not practical in my program, I need to learn how to export masses at a time...
So, I need to write 6 different values from the database table (shown in the picture in red) that are decided by 3 other values (shown in the picture in blue).
I have a Form1 where I can choose the "ProjHenkID", "TyöNro" and "Pvm:" (shown in blue)...
Started the code like:
Code:
Dim MyExcel As New Excel.Application
MyExcel.Workbooks.Open("C:\Tuntilappu.xls")
MyExcel.Visible = True
but don't know how to call values from the database and insert them into specific cells in Excel...
Re: Inserting data from VB into Excel.??? Need help!
Just to make the question more clear...
- How can I insert specific data from my database into specific cells in my existing Excel -file?
(I shoose the "ProjHenkID", "TyöNro" and "Pvm:" -values from my Form1 and by these informations the program should search the 6 different variables from the database and insert them into my Excel files specific cells....)
The picture below shows how the data should be populated into the Excel file....
Re: Inserting data from VB into Excel.??? Need help!
In the .NET CodeBank, I have a class that I use for exporting datatables and datareaders to Excel (search for threads started by me). It will not do exactly what you want, because it fills out data in order, whereas you want specific items to go to specific cells. However, it would be something that you could build from, as you would only be changing the cell indeces, perhaps.
Re: Inserting data from VB into Excel.??? Need help!
Originally Posted by Shaggy Hiker
In the .NET CodeBank, I have a class that I use for exporting datatables and datareaders to Excel (search for threads started by me). It will not do exactly what you want, because it fills out data in order, whereas you want specific items to go to specific cells. However, it would be something that you could build from, as you would only be changing the cell indeces, perhaps.