find/replace text

C

Christine

I've been to the mvp site for Word, and I even found the
page that deals with what I'm having trouble with.
Problem is, I don't have a clue what it all means, nor
how to use the info.

I need to reformat text that is all caps(basically
headings). How do I go about finding it all and replacing
it's format/style?
 
R

Robert M. Franz

Hi Christine
I've been to the mvp site for Word, and I even found the
page that deals with what I'm having trouble with.
Problem is, I don't have a clue what it all means, nor
how to use the info.

Quoting the specific URL would help a bit (as well as your version of
Word :)).

I need to reformat text that is all caps(basically
headings). How do I go about finding it all and replacing
it's format/style?

Is the text in an unique style?

Greetinx
..bob
 
G

Graham Mayor

This page contains a macro that converts any paragraph formatted as Upper
case to be formatted as Heading1 style. In order to make that paragraph
sentence case also - you need an extra line of code
Selection.Range.Case = wdTitleSentence
so the revised macro would be as follows.

I guess also that you don't know what to do with macro listings, so you
should find the tutorial at http://www.gmayor.com/installing_macro.htm
helpful.


Sub FindAllCaps()
'start at beginning of doc
Selection.HomeKey wdStory
'get rid of any previous format criteria in the find dialog
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
'search for any paragraph that has no lowercase letters
'WARNING: If you need to exclude paragraphs with numerals,
'change the .Text argument to [!^013a-z0-9]@^013
With Selection.Find
.Text = "[!^013a-z]@^013"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute()
'change the style only if the found text
'represents the entire paragraph
If Selection.Start = Selection.Paragraphs.First.Range.Start Then
Selection.Style = wdStyleHeading1
'now change to sentence case
Selection.Range.Case = wdTitleSentence
End If
'position the cursor after the found text
'in preparation for finding the next occurrence
Selection.Collapse wdCollapseEnd
Loop
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>><
 
G

Guest

I put the macro in, but not sure what it would've done
since it made Word freeze.

If I have the form

ALLCAPS

text text text
text text text

ALLCAPS

text text text
text text text

This is what I want to do--
make the ALLCAPS size 16 instead of 12 and bold.
Is that possible? And what would the macros be?
 
G

Graham Mayor

The macro I posted converts all ALL CAPS paras to Heading 1 paragraph style,
and then reformats them to sentence case insetead of all caps. It should not
have made Word freeze.

Given what you want to do, the original macro as posted on the web page will
suffice, as it does not change case. Copy and paste that one to your macro
editor over the other. This should reset the macro project but if it doesn't
click reset from the macro editor 'run' menu.

Then all you need to do is reformat Heading 1 paragraph style in the
document to Font size 16 BOLD. This will update all the paragraphs that the
macro has converted to the preferred layout.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 

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