1,随便打开一个word文档。
2,按下Alt + F11 VBA编辑器,在左侧的「工程资源管理器」窗口中找到Normal 项目,右键选择插入->模块。

弹出一下弹窗

3,输入一下代码

代码:
vbscript
Sub RemoveEmptyTableRows()
Dim tbl As Table
Dim row As Row
Dim cell As Cell
Dim i As Long
For Each tbl In ActiveDocument.Tables
' 从最后一行向前遍历,避免删除导致索引变化
For i = tbl.Rows.Count To 1 Step -1
Set row = tbl.Rows(i)
Dim isEmptyRow As Boolean
isEmptyRow = True
For Each cell In row.Cells
' 去除单元格中的控制字符并检查是否为空
Dim cellText As String
cellText = Replace(Replace(cell.Range.Text, Chr(13), ""), Chr(7), "")
If Trim(cellText) <> "" Then
isEmptyRow = False
Exit For
End If
Next cell
If isEmptyRow Then
row.Delete
End If
Next i
Next tbl
MsgBox "处理完成!"
End Sub
Ctrl+S保存一下
然后就可以关掉这个窗口,在回到word界面

4,返回Word界面,按下 Alt + F8,选择RemoveEmptyTableRows,再点击运行,即可完成空白行的批处理。

运行结果
