Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create Excel sheet from recordset
Message
De
11/11/2001 05:09:14
 
 
À
09/11/2001 14:41:02
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00579880
Message ID:
00580231
Vues:
14
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform