T
toolmaker
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.
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.