Solved

Outlook macro to set paragraph spacing

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Outlook Free & Paid Tools
Read this checklist to learn more about the 15 things you should never include in an email signature.
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…

914 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

16 Experts available now in Live!

Get 1:1 Help Now