MergeCells Method (ActiveX)

Merges cells in a table.

Supported platforms: Windows only

Signature

VBA:

object.MergeCells minRow, maxRow, minCol, maxCol
object

Type: Table

The object this method applies to.

minRow

Access: Input-only

Type: Long

The zero-based lower bound of a row index.

maxRow

Access: Input-only

Type: Long

The zero-based upper bound of a row index.

minCol

Access: Input-only

Type: Long

The zero-based lower bound of a column index.

maxCol

Access: Input-only

Type: Long

The zero-based upper bound of a column index.

Return Value (RetVal)

No return value.

Remarks

This method merges a rectangular region of cells. The total number of cells to be merged is equal to (maxRow - minRow + 1) * (maxCol - minCol + 1).

Examples

VBA:

Sub Example_MergeCells()

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)
    Call MyTable.MergeCells(2, 3, 2, 3)

    MsgBox "The cells have been merged appropriately."

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MergeCells()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))
  
    (vla-MergeCells MyTable 2 3 2 3)

    (alert "The cells have been merged appropriately.")

    (vla-ZoomExtents acadObj)
)