如何用vba刪除word表格中的行列?


在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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM