PutRecordsetInCellsThis is a featured page

Function PutRecordsetInCells(ByVal vrs, ByVal voWorksheet, ByVal vsStartCell)
'Puts the results of a SQL statement into the Excel worksheet.
'Returns row count.
'vsStartCell is a cell identifier like "A1" of the
'upper left corner of where the results should go.
' Call PutRecordsetInCells(rs, oWorksheet, "A1")
Dim i, iRowCount

For i = 0 To vrs.Fields.Count - 1
With voWorksheet.Range(vsStartCell).Offset(0, i)
.Value2 = vrs.Fields(i).Name
.Font.Bold = True
.Borders(9).LineStyle = 1 ' <-- 9 means bottom, 1 means continuous.
End With
Next

iRowCount = voWorksheet.Range(vsStartCell).Offset(1, 0).CopyFromRecordset(vrs)
PutRecordsetInCells = iRowCount
End Function


No user avatar
2buck
Latest page update: made by 2buck , Dec 2 2006, 12:09 PM EST (about this update About This Update 2buck Edited by 2buck

1 word added
1 word deleted

view changes

- complete history)
Keyword tags: None (edit keyword tags)
More Info: links to this page

Anonymous  (Get credit for your thread)


There are no threads for this page.  Be the first to start a new thread.