Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Or - without DispatchHelper - you can select range of cells:

Sub SelectColumnTextTable(Optional nCol As Long)
Dim oTextTable As Variant
Dim nLastColumn As Long
Dim nLastRow As Long
Dim oCellRangeByPosition As Variant
Dim oCurrentController As Variant
    oTextTable = ThisComponent.getTextTables().getByIndex(0)
    nLastColumn = oTextTable.getColumns().getCount() - 1
    If IsMissing(nCol) Then nCol = nLastColumn
    If (nCol<0) or (nCol>nLastColumn) Then Exit Sub
    nLastRow = oTextTable.getRows().getCount() - 1

    oCellRangeByPosition = oTextTable.getCellRangeByPosition(nCol, 0, nCol, nLastRow)
    ThisComponent.getCurrentController().select(oCellRangeByPosition)
End Sub