Sub ExportWord()
If k > 12 Then
Dim wdApp As Object
Dim wd As Object
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wd = wdApp.Documents.Open("V:\PRBT_Received\PRBT_EN.doc")
wdApp.Visible = True
Sheets("Macro_EN").Range("A1:B" & k - 1).Copy
wd.Range.Paste
'Ajoute champ "Auteur dans l'en-tete
WordDoc.Fields.Add Range:=WordDoc.Sections(1). _
Headers(wdHeaderFooterPrimary).Range, Type:=wdFieldEmpty, Text:= _
"AUTHOR ", PreserveFormatting:=True
With WordDoc.Sections(1)
'en-tete
.Headers(wdHeaderFooterPrimary).Range.Paragraphs. _
Alignment = wdAlignParagraphCenter
'pied de page
.Footers(wdHeaderFooterPrimary).PageNumbers.Add
End With
wd.SaveAs ("V:\PRBT_Received\" & Range("B9").Value)
Set wdApp = Nothing
Set wd = Nothing
End If
Application.CutCopyMode = False
End Sub