Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-25-2022, 05:58 PM
harry harry is offline Macro not working Windows 10 Macro not working Office 2019
Advanced Beginner
Macro not working
 
Join Date: Jul 2010
Posts: 31
harry is on a distinguished road
Default Macro not working

1. I created the following simple macro in Word, to remove space before and after paragraphs in a document.

Code:
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?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with this Macro-Partially Working rsrasc Excel Programming 10 09-10-2020 02:38 PM
Just one macro not working Ulodesk Word VBA 1 04-01-2019 09:16 AM
How to move data - Macro not working ecarter312 Excel Programming 1 08-10-2016 11:26 PM
Macro not working Fraction macro not working Ulodesk Word VBA 1 07-18-2012 04:01 PM
Macro to open template not working Brandi Mail Merge 2 06-24-2010 09:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft