AStronus
asked on
how do i create excel files using VB?
how do i create excel files using VB with this sample table
Col1 Col2 Col3 Col4
D1 E1 F1 K1
D2 E2 F2 K2
D3 E3 F3 K3
D4 E4 F4 K4
Col1 Col2 Col3 Col4
D1 E1 F1 K1
D2 E2 F2 K2
D3 E3 F3 K3
D4 E4 F4 K4
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AStronus how did you go with my example did it help explain how to control excel from VB?
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook, xldata, chrData
Dim xlsheet As Excel.Worksheet, xlName, xlRow, xlClm
xlName = "c:\test.xls"
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlsheet = xlBook.Worksheets.Add
chrData = 67
For xlClm = 1 To 3
chrData = chrData + 1
For xlRow = 1 To 4
xldata = Chr(chrData) & xlRow
xlsheet.Cells(xlRow, xlClm) = xldata
Next xlRow
Next xlClm
xlsheet.SaveAs xlName
Close #8
xlApp.Quit
Set xlApp = Nothing
Set xlBook = Nothing
Set xlsheet = Nothing
End Sub
cheers
Marcus