Reply
 
Thread Tools Display Modes
  #1   Report Post  
Disastor
 
Posts: n/a
Default Problem with Word Ranges


I am about my wits end trying to deal with the Range object, so
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 text
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 of
the document range to get the tag name and then the tag value. After
it finds a match, it moves on, etc... This part is no problem and it
works just fine.

Certain tag values have to have formatting placed on them based on what
the user types in. So if the user types "My name is Fred", and Fred is
in Bold Text, my value has to read "My name is bFred/b. I can do
formatting properly. My function does this just fine, see below for the
problem.

My dilemma is this though: As I pass my tag value range into my
function that does the formatting, it continues to format the entire
document past the Range.End mark. not just the 25 or so characters I
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 my
desired results, but it goes beyond the Rng.End and continues to format
anything else that may be bolded. I only need it to format the text of
the range that I send it.

--------------------------------------------

I have tried using the Range.Duplicate Property, but that didn't seem
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.


--
Disastor
------------------------------------------------------------------------
Disastor's Profile: http://www.msusenet.com/member.php?userid=1595
View this thread: http://www.msusenet.com/t-1870456324

  #2   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

You have posted in a very heavily trafficked end user NG, which is not
frequented by VBA types; you would be better advised to post in one of the
word.vba hierarchy of NGs.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Disastor" wrote in message
news

I am about my wits end trying to deal with the Range object, so
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 text
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 of
the document range to get the tag name and then the tag value. After
it finds a match, it moves on, etc... This part is no problem and it
works just fine.

Certain tag values have to have formatting placed on them based on what
the user types in. So if the user types "My name is Fred", and Fred is
in Bold Text, my value has to read "My name is bFred/b. I can do
formatting properly. My function does this just fine, see below for the
problem.

My dilemma is this though: As I pass my tag value range into my
function that does the formatting, it continues to format the entire
document past the Range.End mark. not just the 25 or so characters I
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 my
desired results, but it goes beyond the Rng.End and continues to format
anything else that may be bolded. I only need it to format the text of
the range that I send it.

--------------------------------------------

I have tried using the Range.Duplicate Property, but that didn't seem
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.


--
Disastor
------------------------------------------------------------------------
Disastor's Profile: http://www.msusenet.com/member.php?userid=1595
View this thread: http://www.msusenet.com/t-1870456324


  #3   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Disastor,

My dilemma is this though: As I pass my tag value range into my
function that does the formatting, it continues to format the entire
document past the Range.End mark. not just the 25 or so characters I
set for the range. Here is another example to clarify:

--------------------------------------------

Rng.Text="My name is Fred"
Rng.Start=1
Rng.End=15

Unfortunately, you don't show use the part that does the formatting...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making Word do something that Wordperfect can do NarniaUK New Users 4 May 1st 05 10:44 PM
Word 2003 Mailmerge problem - works in Word 2000 Rick Robinson Mailmerge 2 April 28th 05 10:16 AM
1st word in heading flush left second word flush right Elin New Users 9 April 4th 05 08:44 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM
letters - ask/fillin Caroline H New Users 2 February 25th 05 08:19 PM


All times are GMT +1. The time now is 12:30 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"