

If you want to get rid of a paragraph's indentation, click HomeDecrease. The code that automatically performs a first line indent to the tab level of the preceding heading is the original Sub from the first example: Option Explicitĭim firstIndent As Double 'value in "points"įirstIndent = myDoc.Styles(para.Style).ParagraphFormat.LeftIndentĭebug.Print para.Style & " first tab stop at " & _ĭebug. If you find it hard to click and drag the ruler's tiny First Line Indent.

UPDATE2: the sample text original I used in shown in this first document:

Now all indents (except the first line indents made by spaces or tab characters) are removed at once. The code update below accurately determines each Heading indent tab stop. Go to the Paragraph group on the Layout (or Page Layout) tab, and then: (1) In the Left box, please type 0 and press the Enter key (2) In the Right box, please type 0 and press the Enter key. UPDATE1: the earlier version of the code below set the paragraphs to the Document level first tab stop, and did not accurately grab the tabstop set for the Heading styles. If so, then pick off the value of the first tab stop to set as the indent for the subsequent paragraphs. Highlight all the text you want this to happen to (otherwise it'll only work on the line where the cursor is) and drag the triangle to the right. If the number is too wide, it forces the indent to jump to the next default tab stop. To use a macro to accomplish this, you have to check each paragraph in your document and check to see if it is a "Header" style. Those define the 'First Line Indent' and the 'Left Indent'.
