Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Retrieve all Bookmarks in a Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Fellows - 04 Oct 2006 14:32 GMT
Hi,

I am trying to parse through a word doc using vb.net and retrieve the names
of all the bookmarks

I need to be able to do this without knowing how many bookmarks they may be

Thanks in advance

Mike Fellows
Jonathan West - 04 Oct 2006 18:27 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> Mike Fellows

This is how to do it in VBA, you should be able to translate into VB.NET
without too much trouble

To get the bookmarks in alphabetical order of name

Dim oBookmark as Bookmark
For Each oBookmark in ActiveDocument.Bookmarks
   Debug.Print oBookmark.Name
Next oBookmark

To get the bookmarks in the order they appear in the body of the document

Dim oBookmark as Bookmark
For Each oBookmark in ActiveDocument.Range.Bookmarks
   Debug.Print oBookmark.Name
Next oBookmark

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

Mike Fellows - 05 Oct 2006 09:14 GMT
brilliant

thanks for that

>> Hi,
>>
[quoted text clipped - 24 lines]
>    Debug.Print oBookmark.Name
> Next oBookmark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.