Textbox lines into Excel rows

  • Thread starter Thread starter Kevin993
  • Start date Start date
K

Kevin993

Guest
Hi,

I have a a multi line textbox , each line consists of a number , like :

1

2

46

7

...


I tested the code below so as to export textbox value into one excel column :

Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object

oExcel = CreateObject("Excel.Application")
oBook = oExcel.workbooks.add
oSheet = oBook.worksheets(1)

oSheet.range("A1").value = textbox1.text



oBook.saveas("D:\test.xlsx")
oBook.close()

It puts whole the textbox lines in one cell (first row of the "A1" column). It know I should loop through textbox lines and add each of them to a new row. I know how to loop through textbox lines :


For Each line As String In Me.textBox1.Text.Split(vbLf)
'' do something
Next



but I'm not familiar with Excel automation. I would be thankful if you help me out.

Continue reading...
 
Back
Top