could you pls show me how to export to excel
Printable View
could you pls show me how to export to excel
I've taken your post from an old, old thread in the database section and moved it into its own, new, thread.
What platform will you be using, VB6 or VB.NET?
Hi Hack sorry for reply late because i need to settle the Rent interface first before i go into printing invoice for customer . so what is the best way of doing it by excel or by access. with my rent interface there is a print invoice button when the user click on that button it will print the invoice to customer
in the invoice have , customer name, address telphone , invoice number, Item that they rent and so on . i want it a simple way so i try out with excel but excel doesn't show the data in the excel sheet pls help. below are my code
[vb] Code:
Dim objexcel as object Set objexcel= createobject(“Excel.sheet”) objexcel.application.cell(3,9).value=text1.text ‘invoice number objexcel.application.cell(3,12).value=text2.text ‘customer name - - - objexcel.application.visible=true
Your code isn't quite right.. see my Excel tutorial (link in my signature) for the correct methods.
Hi Si _the_geek thanks i have try out it work. now i have another problem is where i need to print something like his
but what i get is something like thisCode:Movie id Movie Name Price
SD1 Superman 9
MT1 Matrix 9
Code:Movie id Movie Name P rice
SD1 MT1
Superman Matrix
9 9
pls help me below is my coding
vb Code:
Dim objexcel As Excel.Application Dim objsheet As Excel.Worksheet Dim objbook As Excel.Workbook Set objexcel = New Excel.Application Set objbook = objexcel.Workbooks.Add Set objsheet = objbook.Worksheets(1) objexcel.Visible = True For i = 0 To titlecount - 1 objsheet.Cells(1, i + 2).Value = List1.List(i) objsheet.Cells(1, 2, i + 1).Value = List2.List(i) objsheet.Cells(3 i + 1).Value = List3.List(i) Next
It looks like you have got the .Cells method a bit confused.. you should be specifying two parameters, which are the Row and Column numbers.
As the row number in this case should be specified based on the loop counter, I presume this is what you want:
..and I hope you have more code than you are showing - as you aren't releasing the object variables, etc.Code:objsheet.Cells(i + 2, 1).Value = List1.List(i)
objsheet.Cells(i + 2, 2).Value = List2.List(i)
objsheet.Cells(i + 2, 3).Value = List3.List(i)
thanks si_the_geek i will try it out and let you know later
:)
Hi Si_thee_geek it work perfectly :afrog: