HTML二级标题加粗,写宏,把加粗并且字数小于20的段设置为二级标题写宏,把加粗并且 爱问知识人...

写宏,把加粗并且字数小于20的段落的样式与格式设置为二级标题。 参考Sub c() ' '标题 9 是以(1)等开头的数字 Dim I As Paragraph, oTxT As String, mySTr As String, mySTyLE As Inte

写宏,把加粗并且字数小于20的段落的样式与格式设置为二级标题。 参考Sub c() ' '标题 9 是以(1)等开头的数字 Dim I As Paragraph, oTxT As String, mySTr As String, mySTyLE As Integer, n As Integer For Each I In ActiveDocument.Paragraphs If I.Range.Information(wdWithInTable) = False Then oTxT = I.Range.Text If oTxT Like "第?章*" Or oTxT Like "第??章*" Or oTxT Like "第???章*" Then I.Style = wdStyleHeading1 GoTo NT End If mySTr = "" For n = 1 To VBA.Len(oTxT) If Mid(oTxT, n, 1) Like "[0-9.]" Then mySTr = mySTr & Mid(oTxT, n, 1) Else Exit For Next If VBA.Len(mySTr) > 0 Then mySTyLE = UBound(VBA.Split(mySTr, ".")) Select Case mySTyLE Case 3 '以 的形式开头的段落 I.Style = wdStyleHeading4 Case 2 '以 1.1.1 的形式开头的段落 I.Style = wdStyleHeading3 Case 1 '以 1.1 的形式开头的段落 I.Style = wdStyleHeading2 Case Else '其他值时 I.Style = wdStyleNormal End Select Else I.Style = wdStyleNormal '其它为正文样式 End If End If NT: Next End Sub

展开

全部

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值