Solved

Outlook macro to set paragraph spacing

Posted on 2009-04-10
4
479 Views
Last Modified: 2012-05-06
Can someone show me how to write an Outlook 2007 macro that I can hookup to a button that does what the code  below (lifted from Word) does:


Function para()
  With Selection.ParagraphFormat
    .SpaceAfter = 12
    .SpaceBefore = 12
  End With
End Function

Open in new window

0
Comment
Question by:tfield98
  • 2
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24119557
Hi, tfield98.

Try this.
Function para()
    Dim olkDoc As Object, _
        wrdSelection As Object
    Set olkDoc = Application.ActiveInspector.WordEditor
    Set wrdSelection = olkDoc.Application.Selection
    With wrdSelection.ParagraphFormat
        .SpaceAfter = 12
        .SpaceBefore = 12
    End With
    Set olkDoc = Nothing
    Set wrdSelection = Nothing
End Function

Open in new window

0
 

Author Closing Comment

by:tfield98
ID: 31569075
Perfect! Exactly what I was looking for. Thanks so much!!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24119725
You're welcome.  Glad I could help.
0
 

Author Comment

by:tfield98
ID: 24119750
Although Outlook has a default template for new emails, I hadn't found a way to have the format of replies set to a default. I was doing it by hand.  This macro lets me simplify the process. It's been bugging me for years!!  Thanks again, BDF!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't know how to downgrade, my instructions below should be helpful.
Find out what you should include to make the best professional email signature for your organization.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question