Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Outlook macro to set paragraph spacing

Posted on 2009-04-10
4
Medium Priority
?
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

618 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