Hi Jay
jay_2882 said:
Thanks for your help. Unfortunately I'm getting an error that says "invalid
use of property" for the line containing "wdDropMargin". Any ideas? Also, I
just want to do the first paragraph after the title. Thanks again.
it seems Ben's newsreader (rightly
) split the line there
(wdDropMargin is supposed to be on the line above). But everything after
the ' is a comment, anyway, so you can safely delete it.
However, you say you want each paragraph after a "title" to have a
DropCap? If you use Heading 1 as a title, the following macro (with Help
from Helmut Weber) should do:
Sub DropCapAfterHeading1()
Dim myPara As Word.Paragraph
If ActiveDocument.Paragraphs.Count > 1 Then
For Each myPara In ActiveDocument.Paragraphs
If myPara.Style = ActiveDocument.Styles(wdStyleHeading1) Then
With myPara.Next
If .Style <> ActiveDocument.Styles(wdStyleHeading2) Then
With .DropCap
.Position = wdDropNormal
.FontName = "+Body"
.LinesToDrop = 3
.DistanceFromText = CentimetersToPoints(0)
End With
End If
End With
End If
Next myPara
End If
End Sub
Watch out for further line breaks (which will happen). The macro does a
tiny bit more, in that it looks at the paragraph following a "Heading 1"
and only adds a drop cap if the style is _not_ "Heading 2". I have no
idea what happens if the first "thing" after a "Heading 1" is a table, a
picture, etc. Does not seem all too likely to test (as unlikely as the
very last paragraph of the document being in "Heading 1", because the
code will probably fail then).
HTH
Robert