none
MS Word Macro Code for Full Justify RRS feed

  • Question

  • I am looking for a line of macro code to add to a macro I have in word which double indents selected text.  I want it to double indent and full justify.  Here is my double indent code.

    Sub DoubleIndent()
        Dim Lindt as Single
        Dim Rindt as Single

        Lindt = Selection.ParagraphFormat.LeftIndent
        Rindt = Selection.ParagraphFormat.RightIndent
        Lindt = Lindt + 18
        If Lindt > 180 Then Lindt = 0
        Rindt = Rindt + 18
        If Rindt > 180 Then Rindt = 0
        Selection.ParagraphFormat.LeftIndent = Lindt
        Selection.ParagraphFormat.RightIndent = Rindt
    End Sub

    Thanks

    Len

    Friday, November 2, 2018 2:36 PM

Answers

  • Add the following line above End Sub:

        Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by LenBB Monday, November 5, 2018 3:07 PM
    Friday, November 2, 2018 3:47 PM

All replies

  • Add the following line above End Sub:

        Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by LenBB Monday, November 5, 2018 3:07 PM
    Friday, November 2, 2018 3:47 PM
  • Hi LenBB,

    Did Hans's answer resolved your problem?

    You can mark it as answer if it helped and please help us close the thread.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Monday, November 5, 2018 2:11 AM
  • He most definitely did.  Many thanks, Hans.

    Len

    Monday, November 5, 2018 3:07 PM