Returning multiple words using find 
Author Message
 Returning multiple words using find

I am using the find command (using selection) to return
any words that have a different colored font. the ultimate
goal is to see what changes have been made and compare
them with entries in a database.  The problem i am having
is that i am only able to return one word at a time,
though i would like to return the whole sentence.  is this
possible?
jason


Tue, 01 Feb 2005 21:14:05 GMT  
 Returning multiple words using find

Sorta kinda. You will need a manual find and replace loop, an
excellent example will be posted VERY shortly via the free newsletter
from www.editorium.com - if you miss Tuesday's post you can get it via
the back issues page - it will be well worth your time to check it
out.

The next tweak is, we have found the word and our range now contains
the word. To get the whole sentence is messy. You MoveEndUntil
Cset:="." and test the next position for a space or para mark, if it's
not a space do another MoveEndUntil.

Getting the start of the sentence is worse - you decrease range.start
and examine .characters(1). If it's a para mark, increase .start by
one and exit - you have your sentence.

If it's a "." and the left of .range.text,2 is ". " (period space)
then increase .start by two and exit - you have your sentence.


went like this:

Quote:
>I am using the find command (using selection) to return
>any words that have a different colored font. the ultimate
>goal is to see what changes have been made and compare
>them with entries in a database.  The problem i am having
>is that i am only able to return one word at a time,
>though i would like to return the whole sentence.  is this
>possible?
>jason

Steve Hudson -- Word Heretic, Sydney, Australia
{*filter*} teacher, trainer, tutor, writer, developer

Word MVP FAQs: http://www.*-*-*.com/
You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Thu, 03 Feb 2005 05:30:12 GMT  
 Returning multiple words using find

Quote:
> The next tweak is, we have found the word and our range now contains
> the word. To get the whole sentence is messy. You MoveEndUntil
> Cset:="." and test the next position for a space or para mark, if it's
> not a space do another MoveEndUntil.

> Getting the start of the sentence is worse - you decrease range.start
> and examine .characters(1). If it's a para mark, increase .start by
> one and exit - you have your sentence.

To expand the current range so it encompasses the whole sentence, you could use

   myRange = myRange.Sentences(1)

or, if you work with the Selection:

   Selection.Sentences(1).Select

The fact that .Item(1) is available though the original Range/Selection doesn't encompass it takes some getting used to.

Another nice thing you can do with Ranges and the Selection is to use ".Last.Next" and ".First.Previous" to pick up stuff that wasn't in the original Range/Selection:
   Selection.Characters.Last.Next.Select
will select the character following the original Selection.

Regards, Klaus



Thu, 03 Feb 2005 07:19:25 GMT  
 Returning multiple words using find

Sorta. Please print sentence(1) of the following line:

Would Dr. Bob please come to reception?

It prints Would Dr.

Not my initial suggested method is any better mind, but once you tweak
it up for your own abbreved exceptions you're OK at last. I avoid
.sentence as I canna trust it.


that went like this:

Quote:
>> The next tweak is, we have found the word and our range now contains
>> the word. To get the whole sentence is messy. You MoveEndUntil
>> Cset:="." and test the next position for a space or para mark, if it's
>> not a space do another MoveEndUntil.

>> Getting the start of the sentence is worse - you decrease range.start
>> and examine .characters(1). If it's a para mark, increase .start by
>> one and exit - you have your sentence.

>To expand the current range so it encompasses the whole sentence, you could use

>   myRange = myRange.Sentences(1)

>or, if you work with the Selection:

>   Selection.Sentences(1).Select

>The fact that .Item(1) is available though the original Range/Selection doesn't encompass it takes some getting used to.

>Another nice thing you can do with Ranges and the Selection is to use ".Last.Next" and ".First.Previous" to pick up stuff that wasn't in the original Range/Selection:
>   Selection.Characters.Last.Next.Select
>will select the character following the original Selection.

>Regards, Klaus

Steve Hudson -- Word Heretic, Sydney, Australia
{*filter*} teacher, trainer, tutor, writer, developer

Word MVP FAQs: http://www.*-*-*.com/
You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Fri, 04 Feb 2005 12:34:43 GMT  
 Returning multiple words using find

Quote:


> Sorta. Please print sentence(1) of the following line:

> Would Dr. Bob please come to reception?

> It prints Would Dr.

> Not my initial suggested method is any better mind, but once you
> tweak it up for your own abbreved exceptions you're OK at last.
> I avoid .sentence as I canna trust it.

Yes, you could fudge something with a list of abbreviations, but it would be a lot of work, and probably not much of an improvement.
To properly decompose a text into sentences, you'd need a good grammar checker combined with a good dictionary that contains the word class (noun, verb, adverb, article ...).

Regards, Klaus



Fri, 04 Feb 2005 15:25:35 GMT  
 Returning multiple words using find
G'day Klaus,

<sighs> I wish I could disagree with you there :-) It would have made
my life a lot easier a few times already if I could HA!

Now, to get down to the grunty end of business - I've searched high
and low for APIs or fileformats or anyway of implementing a lex or
similar - doesn't appear to be any way of utilising the standard stuff
or adding to it. Man, have Jack M Lyons and I got some curly .lex for
them :-)

You know of anything in this area?


that went like this:

Quote:


>> Sorta. Please print sentence(1) of the following line:

>> Would Dr. Bob please come to reception?

>> It prints Would Dr.

>> Not my initial suggested method is any better mind, but once you
>> tweak it up for your own abbreved exceptions you're OK at last.
>> I avoid .sentence as I canna trust it.

>Yes, you could fudge something with a list of abbreviations, but it would be a lot of work, and probably not much of an improvement.
>To properly decompose a text into sentences, you'd need a good grammar checker combined with a good dictionary that contains the word class (noun, verb, adverb, article ...).

>Regards, Klaus

Steve Hudson -- Word Heretic, Sydney, Australia
{*filter*} teacher, trainer, tutor, writer, developer

Word MVP FAQs: http://www.*-*-*.com/
You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Sat, 05 Feb 2005 08:12:25 GMT  
 Returning multiple words using find

Quote:

> G'day Klaus,

> <sighs> I wish I could disagree with you there :-) It would have made
> my life a lot easier a few times already if I could HA!

> Now, to get down to the grunty end of business - I've searched high
> and low for APIs or fileformats or anyway of implementing a lex or
> similar - doesn't appear to be any way of utilising the standard stuff
> or adding to it. Man, have Jack M Lyons and I got some curly .lex for
> them :-)

> You know of anything in this area?

Hi Steve,

No; the Office dictionaries seem pretty impenetrable.
It's one of the cases I would wish for an open source text prcessor: But MS
probably couldn't make the dictionaries accessible if they wanted to,
because they licensed them only.

About four years ago, I played around with my own grammar
checker/translation program. I had been surprised how bad and slow the
existing translation programs worked, and since I prepare foreign language
dictionaries for print, I was in a privileged position to use those
dictionaries for my experiments.

I didn't get far ;-t ...
Then I checked out some open-source grammar checkers/parsers/lexical
analysers/translation programs available, and came to the conclusion that
any halfway serious attempt would take lots of time, and gave up my
dabbling.

Greetings, Klaus



Sat, 05 Feb 2005 11:46:37 GMT  
 Returning multiple words using find
G'day again Klaus,

Quote:
>came to the conclusion that any halfway serious attempt would take lots of
> time, and gave up my dabbling.

Amen to that brother, amen. {*filter*}.


that went like this:

Quote:

>> G'day Klaus,

>> <sighs> I wish I could disagree with you there :-) It would have made
>> my life a lot easier a few times already if I could HA!

>> Now, to get down to the grunty end of business - I've searched high
>> and low for APIs or fileformats or anyway of implementing a lex or
>> similar - doesn't appear to be any way of utilising the standard stuff
>> or adding to it. Man, have Jack M Lyons and I got some curly .lex for
>> them :-)

>> You know of anything in this area?

>Hi Steve,

>No; the Office dictionaries seem pretty impenetrable.
>It's one of the cases I would wish for an open source text prcessor: But MS
>probably couldn't make the dictionaries accessible if they wanted to,
>because they licensed them only.

>About four years ago, I played around with my own grammar
>checker/translation program. I had been surprised how bad and slow the
>existing translation programs worked, and since I prepare foreign language
>dictionaries for print, I was in a privileged position to use those
>dictionaries for my experiments.

>I didn't get far ;-t ...
>Then I checked out some open-source grammar checkers/parsers/lexical
>analysers/translation programs available, and came to the conclusion that
>any halfway serious attempt would take lots of time, and gave up my
>dabbling.

>Greetings, Klaus

Steve Hudson -- Word Heretic, Sydney, Australia
{*filter*} teacher, trainer, tutor, writer, developer

Word MVP FAQs: http://www.*-*-*.com/
You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Sat, 05 Feb 2005 21:40:16 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Find multiple words Using MS Word Find

2. find/replace in a Word Doc using word object and vbscript

3. Finding text inside Word Docs without using Word

4. Finding text inside Word Docs without using Word

5. Finding text inside Word Docs without using Word

6. Finding Files containing text - looking for multiple words

7. Find multiple instances of a specific word and change the color

8. Returning multiple recordsets from AS400(using Client Access)

9. (newbie) returning values from user-defined function using multiple arguments

10. using multiple search criteria to find a record

11. VB.Net using a Word doc object - copying in text w/ a hard return

12. using multiple search criterion to find a record

 

 
Powered by phpBB® Forum Software