|
下面是代码,请楼主看看吧!
Sub 第一章()
Dim i As Paragraph
For Each i In ActiveDocument.Paragraphs
If i.Range.Characters(1) = "第" Then
If i.Range.Characters(3) = "章" Or i.Range.Characters(4) = "章" Or i.Range.Characters(5) = "章" Then
i.Style = ActiveDocument.Styles(wdStyleSubtitle)
With i.Range
With .Font
.Name = "黑体"
.Name = "Arial"
End With
With .ParagraphFormat
.SpaceBefore = 30
.SpaceAfter = 24
.AutoAdjustRightIndent = False
.DisableLineHeightGrid = True
End With
End With
End If
End If
Next
End Sub
*******************还有第一条的代码:
Sub 第一条()
With ActiveDocument.Content.Find
.ClearFormatting
.MatchWildcards = True
With .Replacement
.ClearFormatting
With .Font
.Name = "黑体"
.Bold = True
End With
End With
.Execute FindText:="第[一二三四五六七八九十百零]{1,}条", replacewith:="", Format:=True, Replace:=wdReplaceAll
End With
End Sub |
|