I have problems inserting hyperlinks using c# and the word/office API into a document.
I have a list of bookmarks in a document and I want to create an
appendix table with the names of the bookmarks being hyperlinks to the
bookmark range in the document.
I also have problems just creating hyperlinks in normal text.
I get the error: System.Runtime.InteropServices.COMException: Command
failed at Microsoft.Office.Interop.Word.Hyperlinks.Add(Object Anchor,
Object& Address, Object& SubAddress, Object& ScreenTip,
Object& TextToDisplay, Object& Target)
doc.Hyperlinks.Add(anchor, ref missing, ref subaddress, ref missing, ref missing, ref missing);
All parameters except anchor are optional.
The subaddress is a bookmark:
object subaddress = FindBookmark(doc.Bookmarks, com);
I've have also tried with the name of the bookmark, Bookmark.Name property, and using missing instead of subaddress; same error.
Does anyone have examples of creating hyperlinks? Either into text or tables.