How can we remove page formatting?

S

StargateFan

When I do this process seen below manually, page indents are removed,
regulating spacing before and after lines, etc. Sometimes funny
formatting comes along with text saved from the web ...
*********************************************************************************
Sub INDENTS_remove()
'
With Selection.ParagraphFormat
.Alignment = wdAlignParagraphLeft
.LeftIndent = InchesToPoints(0)
.RightIndent = InchesToPoints(0)
.SpaceBefore = 0
.SpaceAfter = 0
.LineSpacingRule = wdLineSpaceSingle
.FirstLineIndent = InchesToPoints(0)
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
End Sub
*********************************************************************************
The above recorded keystrokes when I went back to various bits of text
and applied it, did not correct the indenting. So I'm guessing that
something needs to be fixed with the above code. What can we do to
it, pls, to have it work as well as when we do this manually.

Again, preferably without doing it via a selection process.

Thanks so much, once again, in advance. :eek:D
 
S

Stefan Blom

Try this:

With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0)
.RightIndent = InchesToPoints(0)
.FirstLineIndent = InchesToPoints(0)
End With

If you don't want to work with a selection, use a range object
instead. For example, to set the indents to zero for all paragraphs in
the active document:

With ActiveDocument.Content.ParagraphFormat
.LeftIndent = InchesToPoints(0)
.RightIndent = InchesToPoints(0)
.FirstLineIndent = InchesToPoints(0)
End With

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top