现有的书签似乎处于只读模式(Vb.net)

时间:2014-02-19 12:03:47

标签: vb.net

Dim oWord As Microsoft.Office.Interop.Word.Application
Dim oDoc As Microsoft.Office.Interop.Word.Document
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add("C:\Users\mattia\Documents\Test.dotx")

我已尝试过所有内容但我无法在书签中写下

oDoc.Bookmarks.Item("Hello").Range.Text = "Hello Word"
oDoc.Fields.Item(0).Result = "HelloWord"

所以我试图检查ContentControls.Count是否为> 0并且属性会向我返回正确数量的现有书签;但例如使用:

oDoc.ContentControls.Item("Hello").Range.Text = "Hello Word"

我总是有同样的错误:“请求的集合成员不存在”

0 个答案:

没有答案