我正在尝试将Belkin
添加到我的word文档的标题中。
情况:
Excel: A1 = Belkin | Word: header needs to get Belkin
答案 0 :(得分:3)
Sub CreateWordDocWithHeader()
Dim WApp As Word.Application
Dim WDoc As Word.Document
Dim WRng As Word.Range
Set WApp = New Word.Application
WApp.Visible = True
Set WDoc = WApp.Documents.Add
Set WRng = WDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range
WRng = ActiveSheet.[A1]
Set WRng = Nothing
Set WDoc = Nothing
Set WApp = Nothing
End Sub
希望这会有所帮助....祝你好运!