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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Dim LL, L As Integer
Dim txt As String
Dim debut, fin As Integer
debut = UserForm1.debut.Text
fin = UserForm1.fin.Text
'MsgBox (debut)
'MsgBox (fin)
Set wordApp = CreateObject("word.application")
LL = Sheets("Feuil1").Range("A65536").End(xlUp).Row + 1
wordApp.Visible = True
Set wordDoc = wordApp.Documents.Open(ThisWorkbook.Path & "\tableau_pour_impression.doc")
'Vide le tableau 1
For L = 2 To 35
wordDoc.Tables(1).Columns(1).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(2).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(3).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(4).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(5).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(6).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(7).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(8).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(9).Cells(L).Range.Text = ""
wordDoc.Tables(1).Columns(10).Cells(L).Range.Text = ""
Next L
For L = 2 To LL + 1
wordDoc.Tables(1).Columns(1).Cells(L).Range.Text = DateValue(Now)
wordDoc.Tables(1).Columns(2).Cells(L).Range.Text = Range("B" & L)
wordDoc.Tables(1).Columns(3).Cells(L).Range.Text = Range("C" & L)
wordDoc.Tables(1).Columns(4).Cells(L).Range.Text = Range("E" & L)
wordDoc.Tables(1).Columns(5).Cells(L).Range.Text = "né(e) le"
wordDoc.Tables(1).Columns(6).Cells(L).Range.Text = Range("F" & L)
wordDoc.Tables(1).Columns(7).Cells(L).Range.Text = Range("K" & L)
wordDoc.Tables(1).Columns(8).Cells(L).Range.Text = Range("J" & L)
Next L
End Sub |
Partager