From: Jules on
I would like to have a macro that puts a bookmark around the text between two
characters (say, # and $) and then deletes the 2 characters. I would only
need this to run once in a document so do not need it to loop.

Is there a way to do this please?
From: Jules on
Thanks Doug. If you see this question again, please disregard it as I
couldn't find this one and reposted it and then found this one.

"Doug Robbins - Word MVP" wrote:

> Use:
>
> Dim bmrange As Range
> Selection.HomeKey wdStory
> Selection.Find.ClearFormatting
> With Selection.Find
> Do While .Execute(FindText:="$^?^?#", Forward:=True, _
> MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=False) = True
> Set bmrange = Selection.Range
> bmrange.Start = bmrange.Start + 1
> bmrange.End = bmrange.Start + 2
> ActiveDocument.Bookmarks.Add "mybookmark", bmrange
> Selection.Collapse wdCollapseEnd
> Selection.MoveRight wdCharacter, 1
> Loop
> End With
>
>
> --
> Hope this helps,
>
> Doug Robbins - Word MVP
>
> Please reply only to the newsgroups unless you wish to obtain my services on
> a paid professional basis.
>
> "Jules" <Jules(a)discussions.microsoft.com> wrote in message
> news:2514D185-F669-4360-92F5-C0B5383A1383(a)microsoft.com...
> >I am trying to find the code to set the range for a bookmark to be the text
> > between 2 characters (maybe, $ and #) and then create a bookmark around
> > this
> > text. I would only need to do this once in the document so do not need it
> > to
> > loop or anything.
> >
> > Would anyone know how I could set this up please?
>
From: Doug Robbins - Word MVP on
See my response yesterday to your question with the same subject.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

"Jules" <Jules(a)discussions.microsoft.com> wrote in message
news:4A62C1AA-865F-4C47-B024-9F3729888B84(a)microsoft.com...
>I would like to have a macro that puts a bookmark around the text between
>two
> characters (say, # and $) and then deletes the 2 characters. I would only
> need this to run once in a document so do not need it to loop.
>
> Is there a way to do this please?