有什么方法可以在word文档上创建书签吗?
我正在使用Microsoft.Office.Interop.Word.dll
我知道如何更新word文档中现有书签的文字。
通过这种方式,我可以更改书签文字
Private Sub document()
Dim objWdDoc As Object
Dim objWord As Object
objWord = CreateObject("Word.Application")
objWdDoc = CreateObject("Word.Document")
objWdDoc = objWord.Documents.Add("C:\Users\iml4203\Desktop\_korisno\Zahtjevikupca.docx")
objWord.Visible = True
With objWdDoc.Bookmarks
.item("Bookmark1").Range.Text = "Test Bookmark"
.item("Bookmark2").Range.Text = "Test Bookmark"
.item("Bookmark2").Range.Text = "Test Bookmark"
End With
End Sub
答案 0 :(得分:1)
只需使用Bookmark.Add
即可创建新书签。这应该让你开始(未经测试!)......
With objwDoc.Bookmarks.Add
' Set the individual properties of the bookmark here
End With