D
Disastor
I am about my wits end trying to deal with the Range object, s
hopefully someone can help me with my dilemma.
I am building a project which scours a Word document for various tags.
An example of a tag would be: [~ItemText~]. After the Tag is some tex
that the user fills in and esentially becomes the value of the tag.
Example:
-[~ItemText~]Why did the chicken cross the road?-
What I have done in my code is move the starting and ending points o
the document range to get the tag name and then the tag value. Afte
it finds a match, it moves on, etc... This part is no problem and i
works just fine.
Certain tag values have to have formatting placed on them based on wha
the user types in. So if the user types "My name is Fred", and Fred i
in Bold Text, my value has to read "My name is <b>Fred</b>. I can d
formatting properly. My function does this just fine, see below for th
problem.
My dilemma is this though: As I pass my tag value range into m
function that does the formatting, it continues to format the entir
document past the Range.End mark. not just the 25 or so characters
set for the range. Here is another example to clarify:
--------------------------------------------
Rng.Text="My name is Fred"
Rng.Start=1
Rng.End=15
I pass the range (Rng) to the Function for formatting and I get m
desired results, but it goes beyond the Rng.End and continues to forma
anything else that may be bolded. I only need it to format the text o
the range that I send it.
--------------------------------------------
I have tried using the Range.Duplicate Property, but that didn't see
to help. Perhaps I was using it incorrectly though.
I have tried just passing the Rng.Text as a String and returning that
but the same results are occurring.
Can anyone assist me with this issue?
Thanks in advance
hopefully someone can help me with my dilemma.
I am building a project which scours a Word document for various tags.
An example of a tag would be: [~ItemText~]. After the Tag is some tex
that the user fills in and esentially becomes the value of the tag.
Example:
-[~ItemText~]Why did the chicken cross the road?-
What I have done in my code is move the starting and ending points o
the document range to get the tag name and then the tag value. Afte
it finds a match, it moves on, etc... This part is no problem and i
works just fine.
Certain tag values have to have formatting placed on them based on wha
the user types in. So if the user types "My name is Fred", and Fred i
in Bold Text, my value has to read "My name is <b>Fred</b>. I can d
formatting properly. My function does this just fine, see below for th
problem.
My dilemma is this though: As I pass my tag value range into m
function that does the formatting, it continues to format the entir
document past the Range.End mark. not just the 25 or so characters
set for the range. Here is another example to clarify:
--------------------------------------------
Rng.Text="My name is Fred"
Rng.Start=1
Rng.End=15
I pass the range (Rng) to the Function for formatting and I get m
desired results, but it goes beyond the Rng.End and continues to forma
anything else that may be bolded. I only need it to format the text o
the range that I send it.
--------------------------------------------
I have tried using the Range.Duplicate Property, but that didn't see
to help. Perhaps I was using it incorrectly though.
I have tried just passing the Rng.Text as a String and returning that
but the same results are occurring.
Can anyone assist me with this issue?
Thanks in advance