Solved

Outlook macro to set paragraph spacing

Posted on 2009-04-10
4
467 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Use email signature images to promote corporate certifications and industry awards.
Resolve DNS query failed errors for Exchange
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now