StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1830458
Impressions6872537
Links
Imprint
Privacy Policy
Contact
HowTo use Word macros in Outlook
Author: Michael BauerHomepage
Date: 06.09.2012Accessed: 9184
  
Description

Since the version 2007, Outlook always uses Microsoft Word as e-mail editor. That is Word's powerful library can be used to edit the content of e-mails and other items.

Another advantage is that there is a macro recorder in Word, which you don't have in Outlook. And that means you can record a macro in Word and copy it to your Outlook VBA project.

Most Word macros use the Selection object, which is automatically available in Word. In order to use such a macro in Outlook, you must declare a variable for that object. Additionally, click Tools/References, and set a reference to the "Microsoft Word x.0 Object Library".

This example demonstrates how to get the most important Word objects. Below where the Selection object is set, insert your Word macro.

Public Sub UseWord()
  Dim Ins As Outlook.Inspector
  Dim Document As Word.Document
  Dim Word As Word.Application
  Dim Selection As Word.Selection

  Set Ins = Application.ActiveInspector
  Set Document = Ins.WordEditor
  Set Word = Document.Application
  Set Selection = Word.Selection

  '...

End Sub
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]