Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 15 Feb 2007 09:08:16 -0800,    group: microsoft.public.word.vba.customization        back       


Make All Bookmarks Editable   
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
date: Thu, 15 Feb 2007 09:08:16 -0800   author:   Rich Hutchins

Re: Make All Bookmarks Editable   
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
> 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.

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


-- 

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
date: Thu, 15 Feb 2007 15:13:29 -0500   author:   Jean-Guy Marcil DontEvenTry@NoSpam

Re: Make All Bookmarks Editable   
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

-- 
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

"Rich Hutchins"  wrote in message 
news:87530B80-6357-433D-9E20-11B44AB063CF@microsoft.com...
> 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
date: Thu, 15 Feb 2007 21:20:34 +0100   author:   Doug Robbins - Word MVP

Re: Make All Bookmarks Editable   
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


"Doug Robbins - Word MVP" wrote:

> 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
> 
> -- 
> 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
> 
> "Rich Hutchins"  wrote in message 
> news:87530B80-6357-433D-9E20-11B44AB063CF@microsoft.com...
> > 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 
> 
> 
>
date: Thu, 15 Feb 2007 12:38:13 -0800   author:   Rich Hutchins

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us