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
|
Sub analyse()
Dim M_object As Word.Document
Dim W_file As Word.Application
For Each Process In GetObject("winmgmts:").InstancesOf("Win32_process")
If Process.Name = "WINWORD.EXE" Then Process.Terminate
Next
chem = ThisWorkbook.Path
n_fil = chem & "\essai.doc"
Set W_file = New Word.Application
'W_file.ShowMe
W_file.Visible = False
Set M_object = W_file.Documents.Open(n_fil)
n_para = M_object.Paragraphs.Count
'On Error Resume Next
deb = 1
For i_para = deb To n_para
n_page = M_objdoc.Paragraphs(i_para).Range.Information(wdActiveEndPageNumber)
le_Style = M_object.Paragraphs(i_para).Style
Le_texte = M_object.Paragraphs(i_para).Range.Text
Sheets(1).Cells(i_para, 1).Select
Sheets(1).Cells(i_para, 1) = le_Style
Sheets(1).Cells(i_para, 2) = Le_texte
Sheets(1).Cells(i_para, 3) = n_page
Next i_para
End Sub |
Partager