Click to See Complete Forum and Search --> : How VB can create a table in Excel worksheet.


Vivien Lee
December 8th, 1998, 09:04 PM
I have encountered a problem the writing codes to create the tables in excel worksheet. Therefor I hope to get some suggestions and recommendation to solve my problem. Thanks a lots for your helps.


Vivien Lee

vivian
December 17th, 1998, 04:50 PM
here is the part of code:

------------------------------------------------

Private Sub Command1_Click()


Dim x1 As Object

Dim sheet As Object

Set x1 = CreateObject("Excel.Application")

x1.Workbooks.Add

Set sheet = x1.ActiveWorkbook.Sheets(1)

x1.Visible = True

For i = 0 To 2

For j = 0 To 9

sheet.Cells(i + 1, j + 1).Value = i + j

Next j

Next i

sheet.SaveAs "c:\temp\data.xls"

x1.Quit

Set x1 = Nothing

End Sub

Vivian
December 17th, 1998, 04:50 PM
here is the part of code:

------------------------------------------------

Private Sub Command1_Click()


Dim x1 As Object

Dim sheet As Object

Set x1 = CreateObject("Excel.Application")

x1.Workbooks.Add

Set sheet = x1.ActiveWorkbook.Sheets(1)

x1.Visible = True

For i = 0 To 2

For j = 0 To 9

sheet.Cells(i + 1, j + 1).Value = i + j

Next j

Next i

sheet.SaveAs "c:\temp\data.xls"

x1.Quit

Set x1 = Nothing

End Sub