renaming bookmarks automatically

J

Jesper F

I have some word templates with a lot of bookmarks.
All bookmarks are named: "1", "2", "3" etc. consecutively.

I'd like to iterate through the bookmarks and rename them - for example
increment their number.
I think I can figure out the renaming part but if someone could please show
me an example of iterations through the bookmarks I'd be grateful.
Thanks for any help.
 
H

Helmut Weber

Hi Jesper,
untested:
dim oBkm as bookmark
for each obkm in activedocument.range.bookmarks
Next

Gives you the bookmarks in the order they appear in the doc,
whereas activedocument.bookmarks gives them in the order,
they were created.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
J

Jesper F

dim oBkm as bookmark
for each obkm in activedocument.range.bookmarks
Next
Gives you the bookmarks in the order they appear in the doc,
whereas activedocument.bookmarks gives them in the order,
they were created.

Just what I needed. Thanks very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top