2017-01-21 63 views
-3

我想要创建一个Word宏,只需单击一下即可完成以下任务。 请帮帮我。 我有一个大文件,这对我来说很麻烦。我想为表格格式创建一个Word宏

任务包括一个表的格式化如

表宽11厘米,
左对齐,
字体TNR 10,
边界黑,从左边是零
缩进。

+0

确定。前进。使用Word宏录制器,并格式化表格(在另一个文档中创建一个小表格)。当你完成后,停止录制和...瞧!你有一个宏!将其复制到您的真实文档中,对您的实际表格进行任何更改以完成设置。 –

回答

0

我得到了宏代码.... 谢谢..

子宏1()

With Selection.tables(1) 
    .Rows.HeightRule = wdRowHeightAuto 
    .PreferredWidthType = wdPreferredWidthPoints 
    .PreferredWidth = CentimetersToPoints(11) 
End With 


With Selection.Borders(wdBorderTop) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 

End With 
With Selection.Borders(wdBorderLeft) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 
End With 
With Selection.Borders(wdBorderBottom) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 
End With 
With Selection.Borders(wdBorderRight) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 
End With 
With Selection.Borders(wdBorderVertical) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 
End With 
    With Selection.Borders(wdBorderHorizontal) 
    .LineStyle = Options.DefaultBorderLineStyle 
    .LineWidth = Options.DefaultBorderLineWidth 
    .Color = Options.DefaultBorderColor 
End With 
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft 
With Selection.ParagraphFormat 
    .LeftIndent = CentimetersToPoints(0) 
    .RightIndent = CentimetersToPoints(0) 
    .SpaceBefore = 0 
    .SpaceBeforeAuto = False 
    .SpaceAfter = 0 
    .SpaceAfterAuto = False 
    .LineSpacingRule = wdLineSpaceSingle 
    .Alignment = wdAlignParagraphLeft 
    .WidowControl = True 
    .KeepWithNext = False 
    .KeepTogether = False 
    .PageBreakBefore = False 
    .NoLineNumber = False 
    .Hyphenation = True 
    .FirstLineIndent = CentimetersToPoints(0) 
    .OutlineLevel = wdOutlineLevelBodyText 
    .CharacterUnitLeftIndent = 0 
    .CharacterUnitRightIndent = 0 
    .CharacterUnitFirstLineIndent = 0 
    .LineUnitBefore = 0 
    .LineUnitAfter = 0 
    .MirrorIndents = False 
    .TextboxTightWrap = wdTightNone 
    .CollapsedByDefault = False 
End With 
With Selection.ParagraphFormat 
    .LeftIndent = CentimetersToPoints(0) 
    .RightIndent = CentimetersToPoints(0) 
    .SpaceBefore = 0 
    .SpaceBeforeAuto = False 
    .SpaceAfter = 0 
    .SpaceAfterAuto = False 
    .LineSpacingRule = wdLineSpaceSingle 
    .Alignment = wdAlignParagraphLeft 
    .WidowControl = True 
    .KeepWithNext = False 
    .KeepTogether = False 
    .PageBreakBefore = False 
    .NoLineNumber = False 
    .Hyphenation = True 
    .FirstLineIndent = CentimetersToPoints(0) 
    .OutlineLevel = wdOutlineLevelBodyText 
    .CharacterUnitLeftIndent = 0 
    .CharacterUnitRightIndent = 0 
    .CharacterUnitFirstLineIndent = 0 
    .LineUnitBefore = 0 
    .LineUnitAfter = 0 
    .MirrorIndents = False 
    .TextboxTightWrap = wdTightNone 
    .CollapsedByDefault = False 
End With 

    With Selection.tables(1).Rows 
    .Alignment = wdAlignRowLeft 
    .AllowBreakAcrossPages = True 
    .SetLeftIndent LeftIndent:=CentimetersToPoints(0), RulerStyle:= _ 
     wdAdjustNone 
End With 

末次

相关问题