1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Option Explicit
Sub creer_TXT()
Dim x As Integer, Cellule As Range, j As Long, Plage As Range, NBlig As Long, LeNom As String, Chemin As String, Suite As Range
x = FreeFile
Set Plage = Worksheets(1).Cells(1, 1).CurrentRegion
NBlig = Plage.Rows.Count
Set Plage = Plage.Offset(1, 0).Resize(NBlig - 1, Plage.Columns.Count)
With Plage.Columns(1)
For Each Cellule In .Cells
LeNom = Cellule.Value
Chemin = "C:\wamp64\www\FICHES\" & Cellule.Value & ".html"
If Dir(Chemin) = "" Then
Open Chemin For Output As #x
Print #x, "<html><head><title> </head> <body> Les personnes</title>la personne concernée se nomme " & LeNom & ", son âge est de "; Cellule.Offset(0, 1).Value; " ans et il habite la ville de "; Cellule.Offset(0, 2).Value; ". "
Print #x, "Ses résultats de CA sont :"
Print #x, "</BR>" & Cellule.Offset(0, 3).Value & " - " & Cellule.Offset(0, 4).Value
Set Suite = .Find(LeNom, LookIn:=xlValues)
If Not Suite Is Nothing Then
j = Suite.Row
Do
If j > Cellule.Row Then Print #x, "</BR>" & Suite.Offset(0, 3).Value & " - " & Suite.Offset(0, 4).Value
Set Suite = .FindNext(Suite)
Loop While Not Suite Is Nothing And Suite.Row > j
End If
Print #x, "</body></html>"
Close #x
End If
Next
End With
End Sub |
Partager