在vba中,Row對象表示word表格的行,Column對象表示word表格的列。
要刪除word表格行、列只需使用對應的Delete方法即可。
代碼如下:
Sub exceloffice() '作者QQ:1722187970,微信:xycgenius,微信公眾號exceloffice Dim oDoc As Document Set oDoc = Word.ActiveDocument Dim oT As Table Dim oRow As Row Dim oColumn As Column With oDoc Set oT = .Tables(1) With oT Set oRow = .Rows(7) oRow.Delete Set oColumn = .Columns(3) oColumn.Delete End With End With End Sub