W
ward
Hello,
I'm a bit confused by the range object.
i have the following code (extraction):
----
Dim Rng As Range
Dim Rng2 As Range
Set Rng = ActiveDocument.Content
With Rng.Find
.Text = "§"
'more options here in the real code
End With
if Rng.Find.Execute
set rng2=rng
rng2.setrange start:=rng.start, end:=rng.end+5
end if
----
I've noticed that be redefining the range of the Rng2
object, I also redefine the range of Rng, which is not
what i want. After all, I've created a Rng2 object, so not
to touch the range of Rng.
Obviously by doing "set Rng2=rng", the 'link' is ByRef
instead of a ByVal. It is the latter that i want, but how
do i do that?
Any idea's/solutions on how my problem can be solved?
Ward
BTW: I can make my code do what i want, by using
Rng.Select
Set Rng2 = Selection.Range
but this makes me use the selection object, which is not
desireable because of e.g. the screenupdates etc.
I'm a bit confused by the range object.
i have the following code (extraction):
----
Dim Rng As Range
Dim Rng2 As Range
Set Rng = ActiveDocument.Content
With Rng.Find
.Text = "§"
'more options here in the real code
End With
if Rng.Find.Execute
set rng2=rng
rng2.setrange start:=rng.start, end:=rng.end+5
end if
----
I've noticed that be redefining the range of the Rng2
object, I also redefine the range of Rng, which is not
what i want. After all, I've created a Rng2 object, so not
to touch the range of Rng.
Obviously by doing "set Rng2=rng", the 'link' is ByRef
instead of a ByVal. It is the latter that i want, but how
do i do that?
Any idea's/solutions on how my problem can be solved?
Ward
BTW: I can make my code do what i want, by using
Rng.Select
Set Rng2 = Selection.Range
but this makes me use the selection object, which is not
desireable because of e.g. the screenupdates etc.