Mon titre ne semblait pas correspondre aux questions qui pouvaient avoir ma réponse, et j'ai trouvé quelques extraits d'autres sujets/sites pour m'aider aussi loin. Je cherche de l'aide pour lier la macro entière ensemble. Voici ce que j'ai jusqu'à présent:Insertion de quelques lignes de texte à la fin d'un document (MS WORD MACRO)
Sub Test()
Selection.EndKey Unit:=wdStory
Dim oPara1 As Word.Paragraph
Set oDoc = oWord.Documents.Add
Set oPara1 = oDoc.Content.Paragraphs.Add
With oPara1.Range
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.InsertParagraphAfter
With .Font
.Name = "Times New Roman"
.Size = "12"
.Bold = True
End With
End With
Selection.TypeText Text:="Fosters, Inc."
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="www.genericwebsite.com"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
'this needs to be left alignment from here on out
Selection.TypeText Text:="Block\Paragraph Format:"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="Run Date:"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="Picture:"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="Symbol:"
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="Guest Book:"
End Sub
Je veux pour passer à la fin du document et imprimer:
Fosters, Inc.
www.genericwebsite.com
Block\Paragraph Format:
Run Date:
Picture:
Symbol:
Guest Book:
Merci pour toute aide - J'ai passé littéralement à une heure ou donc avec vba dans Word aujourd'hui.
Cela fonctionne vraiment bien - le seul problème mineur est que nous créons un nouveau document, alors que je voudrais à insérer à la fin d'un document que nous sommes déjà en –
Mise à jour pour vous de travailler. avec le 'ActiveDocument' – braX
En supposant que cela fonctionne pour vous, s'il vous plaît n'oubliez pas d'accepter cette réponse. – braX