I want the user to be able to select an end-point for a search and replace
range.

After some manipulations, I set the first bookmark like this:

If ActiveDocument.Bookmarks.Exists("myStart") = True Then
ActiveDocument.Bookmarks("myStart").Delete
End If
ActiveDocument.Bookmarks.Add Name:="myStart"

Then I have the user choose an end point, and set the second bookmark:

If ActiveDocument.Bookmarks.Exists("myEndPoint") = True Then
ActiveDocument.Bookmarks("myEndPoint").Delete
End If
ActiveDocument.Bookmarks.Add Name:="myEndPoint"
DeleteRange.DeleteRange

Now I want to select that range, but I haven't been able to do it. I've
tried the following, neither of which work. Any ideas?

Dim myRange as Range
myRange.SetRange Start:=ActiveDocument.Bookmarks("myStart"), _
End:=ActiveDocument.Bookmarks("myEndPoint")
myRange.Select
and

Dim pos1
Dim pos2
Dim r As Range
ActiveDocument.Bookmarks("mystart").Select
Set pos1 = ActiveDocument.Bookmarks("mystart")
ActiveDocument.Bookmarks("myEndPoint").Select
Set pos2 = ActiveDocument.Bookmarks("myendpoint")
pos1.Select
Selection.ExtendMode = True
pos2.Select
Set r = Selection

Thanks for any help you can give me.

Re: need to select range based on bookmarks by Jezebel

Jezebel
Tue May 03 17:30:21 CDT 2005

With ActiveDocument
.Range(Start:=.Bookmarks("MyStart").Range.Start,
End:=.Bookmarks("MyEndPoint").Range.End).Select
End with




"toolmaker" <toolmaker@discussions.microsoft.com> wrote in message
news:8DDBC263-12C3-472C-AE2F-DB41D190702D@microsoft.com...
>I want the user to be able to select an end-point for a search and replace
> range.
>
> After some manipulations, I set the first bookmark like this:
>
> If ActiveDocument.Bookmarks.Exists("myStart") = True Then
> ActiveDocument.Bookmarks("myStart").Delete
> End If
> ActiveDocument.Bookmarks.Add Name:="myStart"
>
> Then I have the user choose an end point, and set the second bookmark:
>
> If ActiveDocument.Bookmarks.Exists("myEndPoint") = True Then
> ActiveDocument.Bookmarks("myEndPoint").Delete
> End If
> ActiveDocument.Bookmarks.Add Name:="myEndPoint"
> DeleteRange.DeleteRange
>
> Now I want to select that range, but I haven't been able to do it. I've
> tried the following, neither of which work. Any ideas?
>
> Dim myRange as Range
> myRange.SetRange Start:=ActiveDocument.Bookmarks("myStart"), _
> End:=ActiveDocument.Bookmarks("myEndPoint")
> myRange.Select
> and
>
> Dim pos1
> Dim pos2
> Dim r As Range
> ActiveDocument.Bookmarks("mystart").Select
> Set pos1 = ActiveDocument.Bookmarks("mystart")
> ActiveDocument.Bookmarks("myEndPoint").Select
> Set pos2 = ActiveDocument.Bookmarks("myendpoint")
> pos1.Select
> Selection.ExtendMode = True
> pos2.Select
> Set r = Selection
>
> Thanks for any help you can give me.



RESOLVED: need to select range based on bookmarks by toolmaker

toolmaker
Wed May 04 09:44:05 CDT 2005

Jezebel:

Thanks muchly! I do appreciate the input. I did work out a similar fix
late yesterday. Looks something like this:

myText = Selection
Selection.ExtendMode = False
Selection.MoveLeft Unit:=wdCharacter, Count:=2 ' Move preserves
bookmark

' after a delete function
With ActiveDocument
Set myRange = _
.Range(Start:=.Bookmarks("myStart").Range.End + 1, _
End:=.Bookmarks("myEndPoint").Range.Start)
End With

NOW I've got to work on the Run-Time Error 5854 problem. There is a
work-around, which I haven't yet figured out how to incorporate.

Thanks again: 'toolmaker'

"Jezebel" wrote:

> With ActiveDocument
> .Range(Start:=.Bookmarks("MyStart").Range.Start,
> End:=.Bookmarks("MyEndPoint").Range.End).Select
> End with
>
>
>
>
> "toolmaker" <toolmaker@discussions.microsoft.com> wrote in message
> news:8DDBC263-12C3-472C-AE2F-DB41D190702D@microsoft.com...
> >I want the user to be able to select an end-point for a search and replace
> > range.
> >
> > After some manipulations, I set the first bookmark like this:
> >
> > If ActiveDocument.Bookmarks.Exists("myStart") = True Then
> > ActiveDocument.Bookmarks("myStart").Delete
> > End If
> > ActiveDocument.Bookmarks.Add Name:="myStart"
> >
> > Then I have the user choose an end point, and set the second bookmark:
> >
> > If ActiveDocument.Bookmarks.Exists("myEndPoint") = True Then
> > ActiveDocument.Bookmarks("myEndPoint").Delete
> > End If
> > ActiveDocument.Bookmarks.Add Name:="myEndPoint"
> > DeleteRange.DeleteRange
> >
> > Now I want to select that range, but I haven't been able to do it. I've
> > tried the following, neither of which work. Any ideas?
> >
> > Dim myRange as Range
> > myRange.SetRange Start:=ActiveDocument.Bookmarks("myStart"), _
> > End:=ActiveDocument.Bookmarks("myEndPoint")
> > myRange.Select
> > and
> >
> > Dim pos1
> > Dim pos2
> > Dim r As Range
> > ActiveDocument.Bookmarks("mystart").Select
> > Set pos1 = ActiveDocument.Bookmarks("mystart")
> > ActiveDocument.Bookmarks("myEndPoint").Select
> > Set pos2 = ActiveDocument.Bookmarks("myendpoint")
> > pos1.Select
> > Selection.ExtendMode = True
> > pos2.Select
> > Set r = Selection
> >
> > Thanks for any help you can give me.
>
>
>