|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 字符设置格式()
- Dim c As New Collection, oPage As Page, oLine As Line, rng As Range, r%
- r = InputBox("请输入字符数")
- On Error Resume Next
- For Each oPage In ActiveDocument.ActiveWindow.ActivePane.Pages
- For Each oLine In oPage.Rectangles(1).Lines
- If r <= oLine.Range.End - oLine.Range.Start Then
- n = n + 1
- Set rng = oLine.Range
- If Right(rng, 1) = Chr(13) Or Right(rng, 1) = Chr(11) Then
- Set rng = ActiveDocument.Range(oLine.Range.End - r - 1, oLine.Range.End - (r - 1) - 1)
- Else
- Set rng = ActiveDocument.Range(oLine.Range.End - r, oLine.Range.End - (r - 1))
- End If
- c.Add rng, CStr(n)
- End If
- Next
- Next
- For i = 1 To c.Count
- With c(i).Font
- .Name = "黑体"
- .Name = "Times New Roman"
- .Size = 10
- .Bold = True
- .Color = wdColorRed
- End With
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|