Sub ExcelVersWord()
Dim Plage As Range
Dim AppWord As Object
Dim Doc As Object
Dim TableWd As Object
Dim I As Integer
Dim J As Integer
'défini la plage utilisée
With Worksheets("Feuil1")
Set Plage = .Range(.Cells(1, 1), _
.Cells( _
.Cells.Find("*", .[A1], -4123, , _
1, 2).Row, _
.Cells.Find("*", .[A1], -4123, , _
2, 2).Column))
End With
'crée une instance de Word
Set AppWord = CreateObject("Word.Application")
With AppWord
.Visible = True
'ouvre un document
Set Doc = .Documents.Open("D:\Test.doc")
With Doc
'crée la table au niveau du signet
Set TableWd = .Tables.Add(.Bookmarks("TableauExcel").Range, _
Plage.Rows.Count, _
Plage.Columns.Count, _
1, _
1)
With TableWd
'ajoute les valeurs
For I = 1 To Plage.Rows.Count
For J = 1 To Plage.Columns.Count
.Cell(I, J).Range.Text = Plage(I, J)
Next J
Next I
End With
End With
End With
End Sub