Hi,
I'm using Visual Studio 2008. I'm working 4 listboxes on a form.I can transfer the datas in the listbox1 and listbox2.There are the time format datas(such as 17:41:00) in the listbox3 and listbox4.But, I can't transfer the datas to excel.(I don't receive any an error.When I transfer the datas to excel, it's coming null the cell in Microsoft Excel) Here is my code.Where I wrong?
Thanks in advance,
I'm using Visual Studio 2008. I'm working 4 listboxes on a form.I can transfer the datas in the listbox1 and listbox2.There are the time format datas(such as 17:41:00) in the listbox3 and listbox4.But, I can't transfer the datas to excel.(I don't receive any an error.When I transfer the datas to excel, it's coming null the cell in Microsoft Excel) Here is my code.Where I wrong?
Code:
On Error Resume Next
Dim excel_uygulamasi As Excel.Application
excel_uygulamasi = CreateObject("excel.application")
excel_uygulamasi.Visible = True
Dim yeni_kitap As Excel.Workbook
yeni_kitap = excel_uygulamasi.Workbooks.Add
Dim tablo As New Excel.Worksheet
tablo = excel_uygulamasi.ActiveWorkbook.ActiveSheet()
Dim i As Long
Dim i2 As Long
Dim i3 As Long
Dim i4 As Long
For i = 1 To ListBox1.Items.Count
tablo.Cells(i, 1).Value = ListBox1.Items.Item(i - 1)
Next
For i2 = 1 To ListBox2.Items.Count
tablo.Cells(i2, 2).Value = ListBox2.Items.Item(i2 - 1)
Next
For i3 = 1 To ListBox3.Items.Count
tablo.Cells(i3, 3).Value = ListBox3.Items.Item(i3 - 1)
Next
For i4 = 1 To ListBox4.Items.Count
tablo.Cells(i4, 4).Value = ListBox4.Items.Item(i4 - 1)
Next
tablo.Cells(1, 1) = "Bant No:"
tablo.Cells(1, 2) = "Tarih:"
tablo.Cells(1, 3) = "Saat:"
tablo.Cells(1, 4) = "Saat2:"
tablo.Application.Cells(1, 1).columnwidth = 6.43 'excel sütün genişliği
tablo.Application.Cells(1, 2).columnwidth = 15
tablo.Application.Cells(1, 3).columnwidth = 11
tablo.Application.Cells(1, 4).columnwidth = 11
Thanks in advance,