Tuesday, 15 June 2010

How to get list of all bookmark-elements from a Word document to an array in order by location: VBA / Word -



How to get list of all bookmark-elements from a Word document to an array in order by location: VBA / Word -

i want fetch bookmarks in word document, , force them array. bookmarks must sorted location in document not name.

ex. here's list of bookmarks in document,

[bm_s] (header) [bm_h] (title) [bm_a] (footer)

i want bookmarks maintain order array following,

array {bm_s, bm_h, bm_a, }

ex. how should not below,

array {bm_a, bm_h, bm_s, }

i got fetching of bookmarks document working. bookmarks in random order when fetching , pushing array.

oki, figured out,

here's how done if else interested in fetching of bookmarks respect location on document.

dim objdoc document set objdoc = activedocument = 1 objdoc.bookmarks.count debug.print objdoc.range.bookmarks(i) 'here can alter code force bookmarks in array next

vba ms-word word-vba

No comments:

Post a Comment