Bonjour, j'utilise le code suivant et il fonctionne très bien sur mon pc (winXP excel 2000) mais dès que je passe sur un autre PC (excel 2000 quand même), il m'indique erreur automation.
pourtant excel 9.0 object library est sélectionné
voila le code aidez moi svp ou je me tire une balle (enfin peut-etre pas)
'***************************************
Set XLS = CreateObject("Excel.application")
XLS.Application.Visible = True
liste.Cols = 4
liste.Rows = 2
For i = 0 To listeconfig.ListCount - 1
If exporter.listeconfig.Selected(i) = True Then
For Each frm In Forms
If listeconfig.List(i) = frm.Caption Then
For j = 2 To frm.pièces.Rows - 1
liste.Rows = liste.Rows + 1
liste.Row = liste.Rows - 1
frm.pièces.Row = j
For k = 0 To 3
liste.Col = k
frm.pièces.Col = k
liste.Text = frm.pièces.Text
Next k
Next j
Surface = Surface + Val(Mid(frm.lbsurface.Caption, 11, InStr(frm.lbsurface.Caption, "m") - 1))
poids = poids + Val(Mid(frm.lbPoids.Caption, 15, InStr(frm.lbPoids.Caption, "K") - 1))
End If
Next frm
End If
Next i
Tri_Liste
XLS.Application.Workbooks.Add
XLS.Application.Range("A8").Value = "Référence"
XLS.Application.Range("B8").Value = "Désignation"
XLS.Application.Range("C8").Value = "Poids"
XLS.Application.Range("D8").Value = "Quantité"
For i = 2 To liste.Rows - 1
liste.Row = i
liste.Col = 0
XLS.Application.Range("A" & i + 7).Value = liste.Text
liste.Col = 1
XLS.Application.Range("B" & i + 7).Value = liste.Text
liste.Col = 2
XLS.Application.Range("C" & i + 7).Value = liste.Text
liste.Col = 3
XLS.Application.Range("D" & i + 7).Value = liste.Text
Next i
XLS.Application.Range("A1").Value = "Surface Totale"
XLS.Application.Range("B1").Value = Surface
XLS.Application.Range("A2").Value = "Poids Total"
XLS.Application.Range("B2").Value = poids
XLS.Application.Range("A3").Value = "Date"
XLS.Application.Range("B3").Value = Date
XLS.Application.Range("A4").Value = "Chantier"
XLS.Application.Range("B4").Value = txtchantier.Text
Unload Me
Exit Sub
'*********************************
ps merci de vos réponses