2016-11-14 82 views
0

我遍歷文檔中的所有段落並希望識別它們的縮進級別。雖然這在大多數情況下使用Paragraph.Format.LeftIndent,但它不適用於表格中的段落。特別是在段落本身沒有縮進但表格有左縮進的情況下。基於當前段落的訪問表對象

有沒有辦法從currelty選定的段落到它所在的表格?我知道有屬性「wdWithInTable」,但這對我來說還不夠,因爲我需要Table對象來檢查其LeftIndent屬性。

回答

0

去拿表從當前選擇用這樣的邏輯:

Sub GetTable() 

    Dim currentTable As Table 

    Set currentTable = Selection.Tables(1) 
    'test purpose only 
    Debug.Print currentTable.Rows.Count, currentTable.Columns.Count 

    'and to get table indention try with this 
    Debug.Print currentTable.Range.ParagraphFormat.LeftIndent 

End Sub