Option Compare Text
Private fso As FileSystemObject
Private dos As Folder
Private fic As File
Private appWd As Word.Application
Private docWd As Word.Document
Sub parcours_fic_ped_page()
Dim lig As Integer
Set fso = New FileSystemObject
Set dos = fso.GetFolder("C:\999999999\")
Set appWd = New Word.Application
lig = 2
For Each fic In dos.Files
If Right(fic.Name, 4) = ".DOC" Or Right(fic.Name, 5) = ".DOCX" Then
Cells(lig, 1) = fic.Name
Cells(lig, 2) = fic.Path
Set docWd = appWd.Documents.Open(fic.Path)
With docWd
Cells(lig, 3) = .Sections(1).Footers(wdHeaderFooterPrimary).Range.Text
End With
docWd.Close
lig = lig + 1
End If
Next
Set appWd = Nothing
End Sub