V
vbaNOOB
Hi All,
For the range object in VBA, there are insertafter and insertbefore function
that insert text in front or behind the a particular range.
My Question is, when I try to insert text behind the range using insertafter
function.
The inserted text carry the style and formatting from the original range.
Eg. "This is a sentence"
Assume the word "is" is my range and is red in color. when I use insertafter
function (myrange.insertafter(" not")) The new inserted word " not" become
red too.
In this case, I know the inserted word is " not" and is red in color. So I
look for any red " not" and change it back. However, in some cases, I dont
know the orignal style of the text, so I can't change it back.
Is there any way that I can insert text after the range without carrying
range style??
I'm not very sure if it's the problem of "paragraph style" and "character
style".
P.s also, I dont get this problem while i insert text before the range using
"insertbefore" funciton. Why is that??
Many thanks
For the range object in VBA, there are insertafter and insertbefore function
that insert text in front or behind the a particular range.
My Question is, when I try to insert text behind the range using insertafter
function.
The inserted text carry the style and formatting from the original range.
Eg. "This is a sentence"
Assume the word "is" is my range and is red in color. when I use insertafter
function (myrange.insertafter(" not")) The new inserted word " not" become
red too.
In this case, I know the inserted word is " not" and is red in color. So I
look for any red " not" and change it back. However, in some cases, I dont
know the orignal style of the text, so I can't change it back.
Is there any way that I can insert text after the range without carrying
range style??
I'm not very sure if it's the problem of "paragraph style" and "character
style".
P.s also, I dont get this problem while i insert text before the range using
"insertbefore" funciton. Why is that??
Many thanks