VBA字子要点

时间:2017-08-03 17:13:14

标签: vba ms-word

我正在试图弄清楚如何在数字项目符号点后使用alpha项目符号。具体来说,我有带文字的子弹1到4,然后我希望在4号下面缩进的A,B,C子弹上写下更多文字,然后继续在数字5,6等上打字。这是在vba中完成生成单词文档。这些行的信息是静态的,不会改变。我也很好奇listtemplate类型让我获得箭头格式化的子弹。

ListGalleries(wdOutlineNumberGallery).ListTemplates(2).Name = ""
 .Selection.range.ListFormat.ApplyListTemplate       ListTemplate:=.ListGalleries(wdOutlineNumberGallery).ListTemplates(2), _
    defaultlistbehavior:=wdWord3ListBehavior

enter image description here
         

1 个答案:

答案 0 :(得分:0)

你真的必须以编程方式进行吗?您可以在段落选项卡中定义新的多级列表。

这里是录制宏的摘录,我将level1项目符号更改为数字,将level2项目符号更改为alpha

录制的宏观有9级子弹

这可能是你的答案:

ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(2).NumberFormat = "%2"

录制的代码低于

With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(1)
    .NumberFormat = "%1"
    .TrailingCharacter = wdTrailingTab
    .NumberStyle = wdListNumberStyleArabic
    .NumberPosition = InchesToPoints(0)
    .Alignment = wdListLevelAlignLeft
    .TextPosition = InchesToPoints(0.25)
    .TabPosition = wdUndefined
    .ResetOnHigher = 0
    .StartAt = 1
    With .Font
        .Bold = wdUndefined
        .Italic = wdUndefined
        .StrikeThrough = wdUndefined
        .Subscript = wdUndefined
        .Superscript = wdUndefined
        .Shadow = wdUndefined
        .Outline = wdUndefined
        .Emboss = wdUndefined
        .Engrave = wdUndefined
        .AllCaps = wdUndefined
        .Hidden = wdUndefined
        .Underline = wdUndefined
        .Color = wdUndefined
        .Size = wdUndefined
        .Animation = wdUndefined
        .DoubleStrikeThrough = wdUndefined
        .Name = ""
    End With
    .LinkedStyle = ""
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(2)
    .NumberFormat = "%2"
    .TrailingCharacter = wdTrailingTab
    .NumberStyle = wdListNumberStyleUppercaseLetter
    .NumberPosition = InchesToPoints(0.25)
    .Alignment = wdListLevelAlignLeft
    .TextPosition = InchesToPoints(0.5)
    .TabPosition = wdUndefined
    .ResetOnHigher = 1
    .StartAt = 1
    With .Font
        .Bold = wdUndefined
        .Italic = wdUndefined
        .StrikeThrough = wdUndefined
        .Subscript = wdUndefined
        .Superscript = wdUndefined
        .Shadow = wdUndefined
        .Outline = wdUndefined
        .Emboss = wdUndefined
        .Engrave = wdUndefined
        .AllCaps = wdUndefined
        .Hidden = wdUndefined
        .Underline = wdUndefined
        .Color = wdUndefined
        .Size = wdUndefined
        .Animation = wdUndefined
        .DoubleStrikeThrough = wdUndefined
        .Name = ""
    End With
    .LinkedStyle = ""
End With