Class Cell (Word VBA)
The class Cell represents a single table cell. The Cell object is a member of the Cells collection. The Cells collection represents all the cells in the specified object.
Class Table gives access to class Cell.
Dim cll as Cell
Set cll = Selection.Cells(Index:=1)
For Each
Here is an example of processing the Cell items in a collection.
Dim cll As Cell
For Each cll In Selection.Cells
If cellLoop.ColumnIndex Mod 2 = 0 Then cellLoop.Column.Shading.Texture = wdTexture10Percent
Next cll
Methods
AutoSum - Inserts an = (Formula) field that calculates and displays the sum of the values in table cells above or to the left of the cell specified in the expression.
Delete - Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
Formula - Inserts an = (Formula) field that contains the specified formula into a table cell.
Merge - Merges the specified table cell with another table cell. The result is a single table cell.
Select - Selects the specified object.
SetHeight - Sets the height of table cells.
SetWidth - Sets the width of columns or cells in a table.
Split - Splits a single table cell into multiple cells.
Properties
Range (Default member) - Returns a Range object that represents the portion of a document that's contained in the specified object.
Borders returns a Borders collection that represents all the borders for the specified object.
BottomPadding returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table.
Column returns a Column object that represents the table column containing the specified cell.
ColumnIndex returns the number of the table column that contains the specified cell.
FitText true if Microsoft Word visually reduces the size of text typed into a cell so that it fits within the column width.
Height returns or sets the height of the specified table cell.
HeightRule returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells or rows.
ID returns or sets the identifying label for the specified object when the current document is saved as a webpage.
LeftPadding returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table.
NestingLevel returns the nesting level of the specified cell.
Next returns a Cell object that represents the next table cell in the Cells collection.
PreferredWidth returns or sets the preferred width (in points or as a percentage of the window width) for the specified cell.
PreferredWidthType returns or sets the preferred unit of measurement to use for the width of the specified cell.
Previous returns a Cell object that represents the previous table cell in the Cells collection.
RightPadding returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table.
Row returns a Row object that represents the row containing the specified cell.
RowIndex returns the number of the row that contains the specified cell.
Shading returns a Shading object that refers to the shading formatting for the specified object.
Tables returns a Tables collection that represents all the nested tables inside the specified table cell.
TopPadding returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table.
VerticalAlignment returns or sets the vertical alignment of text in one or more cells of a table.
Width returns or sets the width of a table cell, in points.
WordWrap true if Microsoft Word wraps text to multiple lines and lengthens the cell so that the cell width remains the same.
Related Classes
Borders - A collection of Border objects that represent the borders of an object.
Column - Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.
Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.
Row - Represents a row in a table. The Row object is a member of the Rows collection. The Rows collection includes all the rows in the specified selection, range, or table.
Shading - Contains shading attributes for an object.
Tables - A collection of Table objects that represent the tables in a selection, range, or document.