texte1 = ActiveDocument.Range(ActiveDocument.Bookmarks("immat").Range.Start, ActiveDocument.Bookmarks("immat").Range.End)
Texte2 = ActiveDocument.Range(ActiveDocument.Bookmarks("NCC").Range.Start, ActiveDocument.Bookmarks("NCC").Range.End)
texte = ActiveDocument.Range(ActiveDocument.Bookmarks("immat").Range.Start, ActiveDocument.Bookmarks("NCC").Range.End)
texte3 = Replace(Replace(Replace(texte, texte1, ""), "FORMTEXT", ""), vbLf, "")
texte5 = Replace(Texte2, "FORMTEXT ", "")
Texte6 = Replace(Texte2, texte5, "")
immat = Mid(texte3, 3, Len(Texte6))
Set DocExel = CreateObject("excel.application")
Set Wkb = DocExel.Workbooks.Open(ActiveDocument.Path & "\" & "Classeur1.xlsx")
DocExel.Visible = True
With Wkb
ligne = 0
On Error Resume Next
ligne = .Sheets("Feuil1").Columns("M:M").Find(What:=immat, After:=.Sheets("Feuil1").Range("M2"), LookIn:=Xlvalues, LookAt:=xlwhole).Row
If ligne > 0 Then
NCC = .Sheets("Feuil1").Range("C" & ligne)
Else
NCC = ""
End If
End With
Wkb.Close True
DocExel.Quit
Selection.GoTo What:=wdGoToBookmark, Name:="NCC"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdMove
Selection.TypeText Text:=NCC
End Sub