Is there any way i can create a bookmark on word document ?
I'm using the Microsoft.Office.Interop.Word.dll
I know how to update text on existing bookmark in word document.
I wonder is there any way to create bookmark. It doesnt need ot be placed on document just to see it
On this way i can change the bookmark text
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
Just use Bookmark.Add
to create a new bookmark. This should get you started (untested!)...
With objwDoc.Bookmarks.Add
' Set the individual properties of the bookmark here
End With