'max number of vba bookmarks

I am currently working on a Word-document I want to use as a template. This template provides a "structure" including many bookmakrs. The template is filled using these bookmarks, e.g. pictures and texts are inserted at places specified by these bookmarks. It works quite well so far, but when I access my worddocument via excel vba, like:

Set appWD = CreateObject("Word.Application")                
appWD.Visible = True
appWD.documents.Open ThisWorkbook.path & "\" & targetName
appWD.documents(targetName).Activate
Set mydoc = appWD.ActiveDocument

only 256 bookmarks are displayed in mydoc.bookmarks despite the count of 391.

snipplets of start and end of bookmark list displayed in excel vba

In Word I can access all 391 bookmarks without any problems. In Excel VBA all bookmarks listed in places higher than those 256 are declared unknown. If I try something like the following I get an error stating myBookMark is unknown.

mydoc.Goto(what:=-1, which:=1, name:=myBookMark).Select

Did anybody experience a similiar problem so far or knows a workaround of how to access bookmarks no. 257 - 391?

thanks a lot



Solution 1:[1]

Max # of bookmarks per document: 16,379

Max length of bookmark names: 40 characters

Why are you trying to select bookmarks, given you don't need to do so? For example:

With mydoc
  .InlineShapes.AddPicture FileName:="Picture Path & name", _
    LinkToFile:=False, Range:=.Bookmarks("myBookMark").Range
End With

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1