|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test删除单行字符()
- Dim i As Paragraph, j$
- With ActiveDocument
- .Content.Find.Execute "[^13^11]", , , 1, , , , , , "^p", 2
- .Select
- CommandBars.FindControl(ID:=122).Execute
- CommandBars.FindControl(ID:=123).Execute
- For Each i In .Paragraphs
- If Asc(i.Range) = 13 Then i.Range.Delete
- Next
- Do
- j = InputBox("请输入欲删除单行字符长度!(默认6字符删除4个汉字!输入较大数字可以删除所有单行字符!)", "删除单行字符", "6")
- If Len(j) = 0 Then End
- For Each i In .Paragraphs
- With i.Range
- If Len(.Text) < j Then
- If .ComputeStatistics(1) = 1 Then .Delete
- End If
- End With
- Next
- If MsgBox("是否继续?", 4 + 16) = vbNo Then End
- Loop
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|