1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Sub MacroWord()
Dim WordObj As Object, Doc As Object, Item, Ligne As Long, Fich As String
Fich = Application.GetOpenFilename("Word Files (*.doc), *.doc")
If Fich <> "" Then
Set WordObj = CreateObject("Word.Application")
WordObj.Visible = True
Set Doc = WordObj.Documents.Open(Fich)
With Sheets("Feuil1")
For Each Item In Doc.Fields
.[A1].Offset(Ligne) = Item.OLEFormat.Object.Text
Ligne = Ligne + 1
Next Item
End With
Doc.Close
WordObj.Quit
Set Doc = Nothing
Set WordObj = Nothing
End If
End Sub |
Partager