運行下面的代碼會引發「請求的收集成員不存在」所有搜索都沒有產生解決方案。Excel VBA修改excel中的word doc - 收集成員錯誤
Sub WordTemplate()
Dim objWordapp As Object
Set objWordapp = CreateObject("Word.Application")
fileStr = "\\int.chc.concepts.co.nz\users\CBotting\Documents\VBA programming\SD Basic Template.docx"
objWordapp.Documents.Open FileName:=fileStr
With objWordapp.Selection.Sections(1).Headers(wdHeaderFooterPrimary)
If .Range.Text <> vbCr Then
MsgBox .Range.Text
Else
MsgBox "Header is empty"
End If
End With
End Sub
我試圖解決這一標題對象
您是否添加了對_Microsoft Word Object Library_的引用? –