View Single Post
  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default Find words which start with a capital letter but are not the f

Almost certainly

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Jezebel wrote:
If the OP had done it manually, the task would have been completed
long since.



"Graham Mayor" wrote in message
...
That was why Jezebel said it was a problem and why I suggested you
step through the found entries. There is no way to do what you want
in a single pass.
You can do it (cautiously) in two passes eg

Find
([! ][ ])([A-Z][a-z]{1,})
replace with
\1b\2/b - format font bold

then
Find
[a-z][ ] format font bold
replace with
^& format font not bold

The following macro, which should be approached with caustion as I
don't know what else is in your document will do that on your sample
text. Sub TagBold()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([! ][ ])([A-Z][a-z]{1,})"
.Replacement.Text = "\1b\2/b"
.Replacement.Font.Bold = True
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[a-z] "
.Font.Bold = True
.Replacement.Text = "^&"
.Replacement.Font.Bold = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

As for multi-posting. It is not the posts in more than one forum
that is the problem, but the lack of a link between them, which
results in duplication of effort by the volunteers who post replied
here. If you access via NNTP it is a simple matter to link the posts
- http://www.gmayor.com/MSNews.htm If you wish to post to more
than one newsgroup, then put all the groups in the same 'send-to'
line separated by commas.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Wire wrote:
Thanks Graham,

Sorry for the multipost, I thought that a programmatic solution may
have been required.

I have tried this search string and it still finds the first word of
every scentence. I will give you a sample paragraph:

"You can click on the Add row button to add an extra Custom Field to
search. You will notice that a new drop down box appears before the
Custom Field drop down box. This will allow you to perform a
Logical Operation between the two fields."

Also, I use 2 spaces after a full stop if that makes any difference.

Thanks.

"Graham Mayor" wrote:

A wildcard search for

[ ][A-Z][a-z]{1,}

replace with

b^&/b format font bold will help find, add the tags and
embolden them, but for reasons addressed by Jezebel I would step
through the document rather than replace all.
See http://www.gmayor.com/replace_using_wildcards.htm

Note that this will embolden the space before the word also. If you
want the leading b to be after the space, you will need another
replace routine to move it.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Wire wrote:
No, I wrote the document, there are no "O'Reilly" like words.

The words are Capitalized because they are Important or Keywords.

I just want to make them all bold as well.

"Jezebel" wrote:

You're going to have to proof-read the damn document anyway if
it's already been screwed around with so badly. Apart from words
at the start of sentences, there are likely to be acronyms (and
words like"O'Reilly") that also need special handling. Trying to
automate this is likely to introduce more problems. Maybe not
many, but you still have to find them.





"Wire" wrote in message
...
How can I find words which start with a capital letter but are
not the first
word in a sentence (or a paragraph).

I have a document where Key Terms have been Capitalized and I
need to change
all these to bBold/b.

I know how to change the formatting. I'm having problems
finding ONLY the Capitalized Words without the finding also all
the first words in a scentence.

I also wish to exclude the word "I" of course.