相关疑难解决方法(0)

'用户定义的类型未定义'错误

我在尝试执行此宏时遇到上述错误.我对Macros和编码很新,所以请原谅无知.

谢谢

Sub DeleteEmptyRows()

Dim oTable As Table, oRow As Row, _
TextInRow As Boolean, i As Long

Application.ScreenUpdating = False

For Each oTable In ActiveDocument.Tables
    For Each oRow In oTable.Rows

        TextInRow = False

        For i = 2 To oRow.Cells.Count
            If Len(oRow.Cells(i).Range.Text) > 2 Then
                'end of cell marker is actually 2 characters
                TextInRow = True
                Exit For
            End If
        Next

        If TextInRow = False Then
            oRow.Delete
        End If
    Next
Next
Application.ScreenUpdating = True

End Sub
Run Code Online (Sandbox Code Playgroud)

excel vba ms-word excel-vba

10
推荐指数
1
解决办法
12万
查看次数

标签 统计

excel ×1

excel-vba ×1

ms-word ×1

vba ×1