probleme vb => excel => sub - VB/VBA/VBS - Programmation
Marsh Posté le 16-03-2005 à 23:26:31
exp.Range("A2" ) = "DBROK SUD"
exp.Range("B1" ) = "Nom Account"
exp.Range("D1" ) = "Evol 0"
exp.Range("E1" ) = "Evol 1"
exp.Range("F1" ) = "Evol 2"
exp.Range("G1" ) = "Evol 3"
exp.Range("H1" ) = "Evol 4"
exp.Range("I1" ) = "Evol 5"
exp.Range("J1" ) = "Evol 9"
entre exp et .Range il faut que tu intercalle le nom d'une feuille (ActiveSheet par exemple). Comme cela:
exp.ActivSheet.Range("A2" ) = "DBROK SUD"
exp.ActiveSheet.Range("B1" ) = "Nom Account"
exp.ActiveSheet.Range("D1" ) = "Evol 0"
exp.ActiveSheet.Range("E1" ) = "Evol 1"
exp.ActiveSheet.Range("F1" ) = "Evol 2"
exp.ActiveSheet.Range("G1" ) = "Evol 3"
exp.ActiveSheet.Range("H1" ) = "Evol 4"
exp.ActiveSheet.Range("I1" ) = "Evol 5"
exp.ActiveSheet.Range("J1" ) = "Evol 9"
Marsh Posté le 16-03-2005 à 19:08:25
Salut,
Qqn pourrait-il me dire pq il me dit "erreur definie par l'application ou par l'objet"
Public exp As Excel.Application
Sub exportExcel()
Dim ligne_account As Integer
Dim colonne_account As Integer
Dim facteur As Integer
ligne_account = 3
colonne_account = 2
facteur = 0
Set exp = CreateObject("excel.application" )
exp.DisplayAlerts = True
exp.Visible = True
exp.Workbooks.Add
exp.Range("A2" ) = "DBROK SUD"
exp.Range("B1" ) = "Nom Account"
exp.Range("D1" ) = "Evol 0"
exp.Range("E1" ) = "Evol 1"
exp.Range("F1" ) = "Evol 2"
exp.Range("G1" ) = "Evol 3"
exp.Range("H1" ) = "Evol 4"
exp.Range("I1" ) = "Evol 5"
exp.Range("J1" ) = "Evol 9"
exp.ActiveSheet.Cells(ligne_account, colonne_account).Value = "2-2"
exp.ActiveSheet.Cells(ligne_account + 9, colonne_account).Value = "1-1"
textes_primes (facteur)
facteur = facteur + 1
textes_primes (facteur)
' exp.ActiveWorkbook.SaveAs "D:\Pipe_" & Day(Date) & "_" & Month(Date) & "_" & Year(Date) & ".xls"
exp.Application.Quit
End Sub
Private Sub textes_primes(valeur As Integer)
exp.ActiveSheet.Cells(4 + valeur * 9, colonne_account).Value = "PP"
End Sub