>I have Word 2000 and have limited experience in writing macros (though I
>was a computer programmer many years ago, so understand logic).
[quoted text clipped - 14 lines]
>
>Barbara
This is one of many things in Word that can't be created with the recorder.
The general idea is to set up a Find that locates a paragraph with the ABC
style, and make that Find repeat until there aren't any more (this is the
purpose of the Do While .Execute ... Loop construction). Each time a paragraph
is found, the text in it is changed to Sentence case.
Sub demo()
Dim oRg As Range
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Text = ""
.Format = True
.Style = ActiveDocument.Styles("ABC")
.Forward = True
.Wrap = wdFindStop
Do While .Execute
oRg.Case = wdTitleSentence
Loop
End With
End Sub
The .Format = True tells VBA to use the .Style as one of the Find criteria (in
fact, since the .Text is empty, the .Style is the only criterion).
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Barbara - 17 Mar 2008 02:46 GMT
On 3/16/2008 5:36 PM Pacific Time, Jay Freedman wrote thusly:
>> I have Word 2000 and have limited experience in writing macros (though I
>> was a computer programmer many years ago, so understand logic).
[quoted text clipped - 46 lines]
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jay,
Outstanding!!!! That worked very fast. You made my day and saved me
many hours of tedious work. :):):) Many blessings upon you.
Irish Blessing
Bless you and yours
As well as the cottage you live in.
May the roof overhead be well thatched
And those inside be well matched.
An Irish Friendship Wish
May there always be work for your hands to do
May your purse always hold a coin or two
May the sun always shine on your windowpane
May a rainbow be certain to follow each rain
May the hand of a friend always be near you
May God fill your heart with gladness to cheer you.
Barbara