my code:
Public Sub ExcelAutomationBtn1()
'Create a new workbook in Excel.
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)
Dim lines
'Transfer the field names to Row 1 of the worksheet:
'Note: CopyFromRecordset copies only the data and not the field
' names, so you can transfer the fieldnames by traversing the
' fields collection.
For Each line In RTBUnformatedData.Lines
lines = Split(RTBUnformatedData.Text, ",") ' split the line of text in the rich text box
oSheet.Cells(1, 5).Value = lines
Next
'Transfer the data to Excel.
'Save the workbook and quit Excel.
oBook.SaveAs("C:\Users\michael\Desktop\test.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
End Sub

New Topic/Question
Reply




MultiQuote





|