Bolding Lower Case Words at Start of Paragraph

T

tbl

After OCRing a rather large glossary, and fixing most of the
common errors, I'd now like to make the "terms" bold (OCR didn't
pick that up).

I'm now using Word 2000, and I haven't played with macros or
WordBasic since Word version 2, remember none of it, and am
wondering if someone would like to suggest the code to:

Search for ^p

If the next character is uppercase, move the cursor (insertion
point?) ignore it and search for the next lowercase character,
and starting from there, search for the next uppercase character.

If the next character is not uppercase, select from the next
character to the character or space before the next uppercase
character, and make the selection bold. Then recurse thru the
document, repeating the above until all the entries have been
treated.

Or something like that

Each glossary entry is a paragraph, with a period at the end.
Unfortunately, only a space separates the "term" from its
definition.


Examples:



A horizon Surface stratum of mineral soil, characterized by
maximum accumulation of [...].

In the above example "A Horizon" should be uppercase.




abiotic Nonliving; the abiotic component of the environment
includes soil, water, air [...].

In the above example, "abiotic" should be uppercase.




C4 plant Any plant that produces as its first step in
photosynthesis a four-carbon com-pound, [...].

In the example above, "C4 plant" should be uppercase, and the
"4" is subscript.



ATP Adenosine triphosphate; major energy-transferring molecules
in all biological sys-tems.

In the example above, "ATP" should be uppercase (this config
could be tough because of no lowercase in the "term").


Thanks, even just for reading!
 
W

Word Heretic

G'day tbl <[email protected]>,

Public Sub FixOCRGlossary()
Dim Finder as Range
Dim Tester as String
Search for ^p


Set Finder=Selection.range.duplicate

with Finder.Find
.text="^p"
.execute replace:=wdreplacenone
end with
If the next character

With Finder
.collapse wdcollapseend
.Moveend wdcharacter,1
end with
Tester=Finder.Text
'is uppercase

if UCase$(Tester)=Tester then

', move the cursor (insertion
point?) ignore it and search for the next lowercase character,
and starting from there, search for the next uppercase character.

'Why dont you just tell me what you want seeing as you are making a
'complete hash of this ;-) Natch I strongly urge you to take the above
'and play with it first and see if you cant work it out yourself
If the next character is not uppercase, select from the next
character to the character or space before the next uppercase
character, and make the selection bold. Then recurse thru the
document, repeating the above until all the entries have been
treated.

End if
End Sub

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


tbl was spinning this yarn:
After OCRing a rather large glossary, and fixing most of the
common errors, I'd now like to make the "terms" bold (OCR didn't
pick that up).

I'm now using Word 2000, and I haven't played with macros or
WordBasic since Word version 2, remember none of it, and am
wondering if someone would like to suggest the code to:

Search for ^p

If the next character is uppercase, move the cursor (insertion
point?) ignore it and search for the next lowercase character,
and starting from there, search for the next uppercase character.

If the next character is not uppercase, select from the next
character to the character or space before the next uppercase
character, and make the selection bold. Then recurse thru the
document, repeating the above until all the entries have been
treated.

Or something like that

Each glossary entry is a paragraph, with a period at the end.
Unfortunately, only a space separates the "term" from its
definition.


Examples:



A horizon Surface stratum of mineral soil, characterized by
maximum accumulation of [...].

In the above example "A Horizon" should be uppercase.




abiotic Nonliving; the abiotic component of the environment
includes soil, water, air [...].

In the above example, "abiotic" should be uppercase.




C4 plant Any plant that produces as its first step in
photosynthesis a four-carbon com-pound, [...].

In the example above, "C4 plant" should be uppercase, and the
"4" is subscript.



ATP Adenosine triphosphate; major energy-transferring molecules
in all biological sys-tems.

In the example above, "ATP" should be uppercase (this config
could be tough because of no lowercase in the "term").


Thanks, even just for reading!
 
T

tbl

[big snip]

'Why dont you just tell me what you want seeing as you are making a
'complete hash of this ;-)


Hehe. The harder I try to be clear, the murkier I get... %-)

Natch I strongly urge you to take the above
'and play with it first and see if you cant work it out yourself

That'll be my next move. Hopefully, tomorrow will provide some
time.

Thanks for your help... you probably saved me much time!
 
T

tbl

G'day tbl <[email protected]>,
[snip]

'Why dont you just tell me what you want seeing as you are making a
'complete hash of this ;-)


It just dawned on me what you were talking about!

Needless to say (now) that in my examples, where I said, "should
be uppercase", I meant, "should be bold" (case not changed).

The village idiot's standing in the community is in peril when
I'm around.
 
W

Word Heretic

G'day tbl <[email protected]>,

<chuckles>

If Range.Font.Bold then ....

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


tbl was spinning this yarn:
G'day tbl <[email protected]>,
[snip]

'Why dont you just tell me what you want seeing as you are making a
'complete hash of this ;-)


It just dawned on me what you were talking about!

Needless to say (now) that in my examples, where I said, "should
be uppercase", I meant, "should be bold" (case not changed).

The village idiot's standing in the community is in peril when
I'm around.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top