|
老师:
我想用vba自动将选定段落的段前间距由0.5行调整为0行。我的代码如下:
Sub 将选定段落的段前间距由原来的05行修正为0行()
With ActiveDocument.Content.Find
.Text = "(四)工程开工、竣工日期*二、实际投资完成情况"
.MatchWildcards = True
Do While .Execute
With .Parent
' .SetRange .Start + Len("(四)工程开工、竣工日期"), .End - Len("二、实际投资完成情况")
.SetRange .Start + Len("(四)工程开工、竣工日期"), .End
.Select
End With
Loop
End With
'段前间距由原来的05行修正为0行
With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.RightIndent = CentimetersToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpace1pt5
.Alignment = wdAlignParagraphJustify
.WidowControl = False
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = CentimetersToPoints(0.85)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 2
.LineUnitBefore = 0
.LineUnitAfter = 0
.MirrorIndents = False
.TextboxTightWrap = wdTightNone
.CollapsedByDefault = False
.AutoAdjustRightIndent = False
.DisableLineHeightGrid = True
.FarEastLineBreakControl = True
.WordWrap = True
.HangingPunctuation = True
.HalfWidthPunctuationOnTopOfLine = False
.AddSpaceBetweenFarEastAndAlpha = True
.AddSpaceBetweenFarEastAndDigit = True
.BaseLineAlignment = wdBaselineAlignAuto
End With
End Sub
段前间距由原来的05行修正为0行这段代码是用录制宏方法获得的,这段代码为何需执行2遍才达目的
请老师指点。
段前间距由原来的05行修正为0行段代码是否可简化为代码
With Selection.ParagraphFormat
.SpaceBefore = 0
.SpaceAfter = 0
End with
请老师指点
谢谢老师
将选定段落的段前间距由原来的05行修正为0行.zip
(12.9 KB, 下载次数: 2)
|
|