Francis,
Showing the code is a good idea, but you also neglected to say on which line
you are having an error and what is the error message.
I suspect the problem is that your code is .add ing the same bookmark you
just created or there is punctuation in the selection. In other words, each
time you use the .add method, it is attempting to add a bookmark.
If you a trying to get rid of all the space characters in the selection to
create a bookmark name of the selection,
then trim and replace outside of the .add method
or do both those operations inside **one** .add method.
You can 'nest' functions within each other.
There might be some limit on how long your bookmark name may be. But on the
outer part of the 'nest' you could use the Left() function to create a name
of only so many characters.
Use one .add line:
.Add Range:=myBookmarkRange, Name:=Left(Trim(Replace( _
myBookmarkRange.Text, " ", "_")), 15)
Be aware, selecting anything with punctuation ( other than underscores )
will cause an bookmark name error.
Rather than self-generating a bookmark name, it might be better to pop up an
inputbox to ask for a bookmark name. You could have the default text be part
of the selection, which you could edit to make a legitimate bookmark name.
Dim BookmarkName As String
BookmarkName = InputBox("Bookmark Name Suggestion:" & vbCr _
& "Delete any punctuation!" & vbCr & "_ Underscores are OK", _
"What is the Bookmark Name?", Left(Trim _
(Replace(myBookmarkRange.Text, " ", "_")), 45))
Use one .add line:
.Add Range:=myBookmarkRange, Name:=BookmarkName
Good Luck!
> Back again without success - it's more of a challenge than a need since the
> TOC way pretty well does what I want but there are times when I should like
[quoted text clipped - 58 lines]
>>>>> .ShowHidden = False
>>>>> End With

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Francis Hookham - 05 Jul 2007 11:49 GMT
Again Russ - apologies for not getting back on all your help - busy, busy -
I'm going to have to let this one keep for a bit longer - I'm limping with
my workhorse computer in for repair and a holiday coming up - might not get
to it until mid-Aug
Thanks VERY much
Francis
> Francis,
> Showing the code is a good idea, but you also neglected to say on which
[quoted text clipped - 107 lines]
>>>>>> .ShowHidden = False
>>>>>> End With