Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

Newest Tips

Arranging Document Windows

Specifying a Backup Location

Controlling Chart Gridlines

Merging Table Cells

Collapsing and Expanding Subdocuments

Zooming With the Keyboard

Initiating a New Search

 

Getting the Names of Defined Bookmarks with WordBasic

Summary: Want to find out the names of bookmarks? This WordBasic code will do it for you. (This tip works with Microsoft Word 6, and Word 95.)

Chances are good that you already know how to use bookmarks. (Other WordTips have described how to define and manipulate them.) If you are creating macros, you may have a need to retrieve the names of the bookmarks defined within a document.

WordBasic lets you retrieve bookmark names by using the contents of the BookmarkName array. The syntax of the statement is as follows:

x$ = BookmarkName(y)

where y is the offset pointer to the bookmark name wanted. After executing the statement, x$ will contain the name of the bookmark specified by the pointer. To make this function useful, you really should read all the bookmark names into an array, which you can then manipulate. The following code fragment will do the trick:

Dim Bmk() As String
Dim x As Integer, J As Integer

x = CountBookmarks
Dim Bmk$(x)
For j = 1 to x
    Bmk$(j) = BookmarkName(j)
Next j

Tip #761 applies to Microsoft Word versions: 6 | 95

Create Rock-Solid Lists! Bulleted and numbered lists can help make your writing clearer and easier to follow. If not done properly, however, they can be a nightmare to work with. Discover the ins and outs of Word's lists with this great reference available in two versions.
 
Check out Word Bullets and Numbering today!