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
| Sub test()
Dim s1 As String
s1 = Application.CurrentProject.Path & "\" & "monDoc.docx"
Call OpenDocument(s1, 102, Date)
End Sub
Private Sub OpenDocument(strFileName As String, lngCoursNum As Long, dt1 As Date)
Dim WordApp As Word.Application, WordDoc As Word.Document
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordApp.Activate
'Set WordDoc = WordApp.Documents.Open("d:\acrf\recettes\R" & N & ".docx")
Set WordDoc = WordApp.Documents.Open(strFileName)
With WordDoc.Sections(1).Footers(wdHeaderFooterPrimary).Range
.Text = "ACRF Cours de cuisine Claudine MARTIN Numéro du cours : " & lngCoursNum & " Date : " & dt1
.Bold = True
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With
WordDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "CUISINE"
WordDoc.Save ' Enregistrer
End Sub |