murgatroyd
Senior Member
- OS Version(s)
- Windows
- Outlook version
- Outlook 2021 64 bit
- Email Account
- POP3
1. I created the following simple macro in Word, to remove space before and after paragraphs in a document.
----------
Sub ClearParagraphSpacing()
Selection.WholeStory
With Selection.ParagraphFormat
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
End With
End Sub
----------
This works fine in Word, but when I copy it into Outlook, I get an error when I run it on a new email or a reply: "Object variable or With block variable not set." How can I fix this?
2. I can add a shortcut for the macro on the Ribbon or the Quick Access Toolbar, but when I click on it, nothing happens. However, as the macro needs to work in a message editing window (not in the main folder window), does it need a different kind of shortcut?
----------
Sub ClearParagraphSpacing()
Selection.WholeStory
With Selection.ParagraphFormat
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
End With
End Sub
----------
This works fine in Word, but when I copy it into Outlook, I get an error when I run it on a new email or a reply: "Object variable or With block variable not set." How can I fix this?
2. I can add a shortcut for the macro on the Ribbon or the Quick Access Toolbar, but when I click on it, nothing happens. However, as the macro needs to work in a message editing window (not in the main folder window), does it need a different kind of shortcut?
Last edited: