Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Line by Line Left Indent greater than or equal to the line before it - VBA MS Word Macro

$
0
0

I'm trying to create a macro that goes throgh each line and makes sure that any line that has an indent of 0 has an indent greater than or equal to the indent of the line before it. If it is not greaterthan or equal to the line before it, I want the indent to be equal to the previous line.

I've found Selection.Paragraphs.LeftIndent is the code that I need to work with but I'm not good at constructing simple code like this without an example of how to do it. I was thinking a "For each oPara In ActiveDocument.Paragraphs" loop but unsure on how to actually code it.

Dim oPara As Object

For Each Para In .Paragraphs

   If Para.Paragraphs.LeftIndent = 0 Then
       get paragraph indent of the previous paragraph
       If then comparitive indent statment
           make the current paragraph = to previous Para
       End If
   End If
Next

Here's an example of what I'm working with. Sorry, it won't let me post a hyperlink. "(dot)" to "."

dl.dropboxusercontent(dot)com/u/22523394/Indent%20Example%20.docx


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>