Excel Data type for Access

waxmie
07-18-2003, 06:56 AM
i create a code for erase excel file and re-create, but i haveone problem, i loss data type (numeric double with general format)

how i can insert datatype in my coding ???

Public Function CreationExcel(Path As String, tableau() As String) As Boolean
Dim rst As Recordset, rstExcel As Recordset
Dim app As Excel.Application
Dim feuille As Excel.Worksheet
Dim i As Integer

On Error GoTo fin
Set app = New Excel.Application

'si on veut voir le fichier en création
'app.Visible = True

's'il existe, on l'efface
If Not Dir(Path) = "" Then
Kill Path
End If

'création du fichier
app.Workbooks.Add

'on va chercher la feuille
Set feuille = app.Workbooks.Item(1).Sheets.Item(1)

'ajoute les entêtes à la feuille 1
For i = 1 To UBound(tableau) - LBound(tableau) + 1
feuille.Cells(1, i) = tableau(i)
Next i

'sauvegarde
app.Workbooks.Item(1).SaveAs Path
'ferme
app.Workbooks.Close
'on quitte Excel
app.Quit
Set app = Nothing

'Réussite
CreationExcel = True
Exit Function

fin:
'Échec
CreationExcel = False
End Function

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum