Sub temp1()
Dim oTable As AcadTable
Dim insPt
Dim iRows As Long, iCols As Long
Dim rowHgt As Double, colWid As Double
Dim col As New AcadAcCmColor
insPt = ThisDrawing.Utility.GetPoint(, "Pick table insertion point:")
iRows = 2
iCols = 2
rowHgt = 4
colWid = 6
Set oTable = ThisDrawing.ModelSpace.AddTable(insPt, iRows, iCols, rowHgt, colWid)
oTable.RegenerateTableSuppressed = True
oTable.SetText 0, 0, "1"
oTable.SetText 1, 1, "2"
oTable.SetText 1, 0, "3"
col.ColorIndex = Val(oTable.GetText(1, 1))
If col.ColorIndex <> acWhite And col.ColorIndex <> 0 Then
oTable.SetCellBackgroundColor 1, 1, col
oTable.SetCellBackgroundColorNone 1, 1, False
End If
oTable.RegenerateTableSuppressed = False
End Sub
Sub temp2()
Dim oTable As AcadTable
Dim col As New AcadAcCmColor
Dim returnObj As AcadObject
Dim basePnt As Variant
On Error Resume Next
ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select a table"
Set oTable = returnObj
oTable.RegenerateTableSuppressed = True
oTable.SetText 1, 0, Trim(Str(Val(oTable.GetText(1, 0)) + 1))
col.ColorIndex = Val(oTable.GetText(1, 0))
If col.ColorIndex <> acWhite And col.ColorIndex <> 0 Then
oTable.SetCellBackgroundColor 1, 0, col
oTable.SetCellBackgroundColorNone 1, 0, False
End If
oTable.RegenerateTableSuppressed = False
End Sub