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 enteteEtPiedDePageWord()
'necessite d'activer la reference microsoft Word xx.x Object Library
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Creer_fichier:
With Worksheets(1)
Set objHyper = _
.Hyperlinks.Add(Anchor:=.Range("A1"), _
Address:="entete.doc")
objHyper.CreateNewDocument _
Filename:="D:\Chauffage\test\Essais Visual Basic\entete.doc", _
EditNow:=True, Overwrite:=True
End With
Worksheets("Tampon Word (2)").Range("A1:G10").Copy
entete:
With wordDoc.Sections(1)'ici ça coince.Problème d'objet,je n'arrive pas à le définir.
.Headers(wdHeaderFooterPrimary).Range.Paste '(ce qui remplace le titre)
.Headers(wdHeaderFooterPrimary).Range.Paragraphs.Alignment = wdAlignParagraphCenter
.Footers(wdHeaderFooterPrimary).PageNumbers.Add
End With
End Sub |
Partager