0
我的标题似乎不符合可能有我的答案的问题,并且我确实从其他主题/网站找到了一些片段以帮助我获得到目前为止。我正在寻找将整个宏捆绑在一起的帮助。以下是我迄今为止:在文档的末尾插入几行文字(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
我希望它移动到文件和打印结束:
Fosters, Inc.
www.genericwebsite.com
Block\Paragraph Format:
Run Date:
Picture:
Symbol:
Guest Book:
感谢您的帮助 - 我从字面上只花了一个小时所以今天在Word中使用vba。
这个作品真的很好 - 唯一的小问题是,我们创建一个新的文件,而我想它在文档的末尾,我们已经是在插入 –
更新它为您的工作。与'ActiveDocument' – braX
假设它适合你,请记得接受这个答案。 – braX