PDA

Click to See Complete Forum and Search --> : Populating an Excel sheet


Dorothy
Aug 27th, 2002, 10:44 PM
I have an xls file at "C:\test.xls". I need to populate the xls file with values of a string array.

Help me out?

cim3
Aug 28th, 2002, 04:03 AM
Just the same as in VB - add a reference to the excel object model.

Dim a As New Excel.Application()
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet

wb = a.Workbooks.Open("C:\book1.xls")

ws = wb.Worksheets.Item(1)

With ws
'populate titles
.Cells(1, 1).value = "Date"
.Cells(1, 2).value = "Location"

.Cells(2, 1).value = YOUR STRING VALUE
.Cells(2, 2).value = YOUR STRING VALUE
End With