Results 1 to 4 of 4

Thread: Simple macro in Outlook to remove spacing: Object required error message

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    No that is not right way to use same code on word and outlook. Try this code:

    <pre>Sub FixParagraphSpacing()    
    Dim objOL As Application
    Dim objDoc As Object
    Dim objSel As Object
    Set objOL = Application
    Set objDoc = objOL.ActiveInspector.WordEditor
    Set objSel = objDoc.Windows(1).Selection
    objSel.ParagraphFormat.SpaceBefore = 0
    objSel.ParagraphFormat.SpaceBeforeAuto = False
    objSel.ParagraphFormat.SpaceAfter = 0
    objSel.ParagraphFormat.SpaceAfterAuto = False
    Set objOL = Nothing
    Set objDoc = Nothing
    Set objSel = Nothing End Sub </pre>
    may be it is helpful for you.
    Last edited by Aussiebear; 05-23-2023 at 12:49 AM. Reason: Corrected the Code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •