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 / February 2007

Tip: Looking for answers? Try searching our database.

Make All Bookmarks Editable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich Hutchins - 15 Feb 2007 17:08 GMT
Is it possible to programmatically make all bookmarks in the Bookmarks
collection editable (WdEditorType.wdEditorEveryone)? I know how to do it
one-by-one, but I'm going to need to work with a collection of an unknown
number of bookmarks and unknown bookmark names. For example, one document may
have:

MyBookmark1
MyBookmark15
MyBookmark33

Another document may have:

MyBookmark44

And another document may not have any bookmarks at all. But all existing
bookmarks will be in the format: MyBookmarkNN

Any and all help is greatly appreciated.

Thanks,
Rich
Jean-Guy Marcil - 15 Feb 2007 20:13 GMT
Rich Hutchins was telling us:
Rich Hutchins nous racontait que :

> Is it possible to programmatically make all bookmarks in the Bookmarks
> collection editable (WdEditorType.wdEditorEveryone)? I know how to do
[quoted text clipped - 14 lines]
>
> Any and all help is greatly appreciated.

Here's one way to access all the bookmarks:

Dim bkmDocument As Bookmarks
Dim i As Long

Set bkmDocument = ActiveDocument.Bookmarks

For i = 1 To bkmDocument.Count
   'your code, e.g.:
   bkmDocument(i).Range.Font = "Arial"
Next

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Doug Robbins - Word MVP - 15 Feb 2007 20:20 GMT
I don't really know what you mean, but to do something to all of the
bookmarks in a document, you could use

Dim i as Long
For i = ActiveDocument.Bookmarks.Count to 1 Step -1
   With ActiveDocument.Bookmarks(i)
       .DoWhateverYouWant
   End With
Next i

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Is it possible to programmatically make all bookmarks in the Bookmarks
> collection editable (WdEditorType.wdEditorEveryone)? I know how to do it
[quoted text clipped - 18 lines]
> Thanks,
> Rich
Rich Hutchins - 15 Feb 2007 20:38 GMT
Thank you Doug and Jean-Guy for your responses. About the same time you
posted your suggestions, I got the following code to do what I need it to do
(at least on the surface it appears to do what I need it to do since I no
longer have any problems editing user-added bookmarks):

Dim bkMark As Bookmark            
For Each bkMark In ActiveDocument.Bookmarks
   bkMark.Range.Editors.Add (Word.WdEditorType.wdEditorEveryone)
Next bkMark

As usual, one of the many ways to solve the problem so I _think_ I'm OK with
this solution. I need to try to abuse it like a user would, but I think it'll
survive.

Thanks again for taking the time.

Rich

> I don't really know what you mean, but to do something to all of the
> bookmarks in a document, you could use
[quoted text clipped - 28 lines]
> > Thanks,
> > Rich
 
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.