Word刪除空白段落的宏代碼介紹推薦閱讀

通過如下的宏代碼,您就可以在WORD中刪除空白的段落 。
Sub DelBlank()
Dim i As Paragraph, n As Long
Application.ScreenUpdating = False ’關閉屏幕刷新
For Each i In ActiveDocument.Paragraphs ’在活動文檔的段落集合中循環
If Len(i.Range) = 1 Then ’判斷段落長段,此處可根據文檔實際情況
i.Range.Delete ’進行必要的修改可將任意長度段落刪除
n = n + 1 ’計數
【Word刪除空白段落的宏代碼介紹推薦閱讀】End If
Next
MsgBox "共刪除空白段落" & n & "個!"
Application.ScreenUpdating = True ’恢復屏幕刷新
End Sub
代碼簡單,功能強大,希望對您有所幫助

    推薦閱讀