Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Excel sheet from recordset
Message
From
11/11/2001 05:09:14
 
 
To
09/11/2001 14:41:02
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00579880
Message ID:
00580231
Views:
13
Try using following


' rst is a recordset
dim xl as Excel.Application
dim wb as Excel.WorkBook
dim ws as Excel.Worksheet

set xl=CreatObject("Excel.Application")
xl.visible=true
set wb=xl.Workbooks.Add
set ws=xl.worksheets(1)

for fieldno=0 to rst.Fields.count-1
ws.Range(Chr(fieldno+65) & "1")=rst.fields(fieldno).Name
next

for recno=1 to rst.RecordCount
for fieldno=0 to rst.Fields.count-1
ws.Range(Chr(fieldno+65) & recno )=rst.fields(fieldno).Value
next
next
'save workbook

for more
mailtorafiq@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform