word中删除空行

来源:互联网 发布:2017新款男鞋推荐知乎 编辑:程序博客网 时间:2024/05/03 20:47

 Visual Basic编辑器中输入:
Sub DelBlank()
Dim i As Paragraph, n As Integer
Application.ScreenUpdating = False
For Each i In ActiveDocument.Paragraphs
If Len(i.Range) = 1 Then
i.Range.Delete
n = n + 1
End If
Next
MsgBox "共删除空白段落" & n & "个"
Application.ScreenUpdating = True
End Sub
然后运行就OK了。

原创粉丝点击