'* +++++++++++++++++++++++++++++
'* Created By I Love You_Word!@ExcelHome 2005-6-2 17:15:58
'仅测试于System: Windows NT Word: 10.0 Language: 2052
'^The Code CopyIn [ThisDocument-ThisDocument]^'
'* -----------------------------
Sub CenterPara()
On Error Resume Next '忽略错误
Application.ScreenUpdating = False
With Selection.ParagraphFormat '针对选定对象
.LeftIndent = 0 '删除左缩进
.RightIndent = 0 '删除右缩进
.FirstLineIndent = 0 '删除首行缩时
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.Alignment = wdAlignParagraphCenter '段落居中
End With
Application.ScreenUpdating = True
' 上面就是,但有时不好用,所以,我就给他运行两次。加了下面相同的代码
On Error Resume Next '忽略错误
Application.ScreenUpdating = False
With Selection.ParagraphFormat '针对选定对象
.LeftIndent = 0 '删除左缩进
.RightIndent = 0 '删除右缩进
.FirstLineIndent = 0 '删除首行缩时
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.Alignment = wdAlignParagraphCenter '段落居中
End With
Application.ScreenUpdating = True
End Sub
[此贴子已经被作者于2005-7-19 19:55:47编辑过] |