Is there a way to indent a line of text inside the table of a Word document using Visual Basic? RRS feed

  • Question

  • I created a new Word document using Visual Basic and I've got several lines of text in a table inside the Word document. 

    I was just wondering if there is a way to indent some of these lines of text a few spaces inside the table cells, so these lines of text don't all start at the same position on the left side of the table cell?

    Thanks in advance,


    James Hutchinson

    Sunday, March 27, 2016 10:56 PM


  • As indicated in previous discussions, the correct way to apply paragraph-level formatting is via a paragraph Style; otherwise you could use code like:

    With ActiveDocument.Tables(1).Range.Paragraphs(1)
      .LeftIndent = InchesToPoints(0.375)
      .FirstLineIndent = InchesToPoints(-0.25)
      .RightIndent = InchesToPoints(0.125)
    End With

    depending, of course, on which aspects on the indenting you want to manipulate.

    Paul Edstein
    [MS MVP - Word]

    Monday, March 28, 2016 12:05 AM