Word Table Cell Height

Maxine Nietz 1 Reputation point
2024-11-04T19:04:54.2933333+00:00

Word VBA. Office 365.

I need to go to a specific table cell and change it's height.

Thanks in advance.

Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
883 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,986 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jonas Kufner 80 Reputation points
    2024-11-04T20:19:08.7233333+00:00

    Hi @Maxine Nietz ,

    hope thats helps:

    Sub ChangeTableCellHeight()

    Dim doc As Document

    Dim tbl As Table

    Dim cell As Cell

    ' Reference the active document

    Set doc = ActiveDocument

    ' Reference the specific table (1 for the first table in the document)

    Set tbl = doc.Tables(1)

    ' Reference the specific cell (change row and column as needed)

    Set cell = tbl.Cell(Row:=2, Column:=3)

    ' Change the cell height

    cell.Height = InchesToPoints(0.5) ' Change to desired height in inches

    ' Optional: Set height rule

    cell.HeightRule = wdRowHeightExactly ' Other options: wdRowHeightAtLeast or wdRowHeightAuto

    End Sub

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  2. Paul Edstein 491 Reputation points
    2024-11-05T00:52:00.9233333+00:00

    At its simplest:

    Sub ChangeTableCellHeight()
    With ActiveDocument.Tables(1).Cell(Row:=2, Column:=3) ' change table, row & column refs to suit

    .HeightRule = wdRowHeightExactly ' or wdRowHeightAtLeast

    .Height = InchesToPoints(0.5) ' or CentimetersToPoints(1.27), using the appropriate value.

    End With

    End Sub

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.