Consulting

Results 1 to 3 of 3

Thread: Add message to all emails in my Outlook outbox

  1. #1
    VBAX Regular tactps's Avatar
    Joined
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    10
    Location

    Add message to all emails in my Outlook outbox

    Hi,

    I have about 100 emails in my outbox that have attachments and subject lines, but no message (mail merge from Word as attachment).

    I would like to add an identical message to each of those emails before sending them.

    Can you please give me the VBA syntax for this?

    Outlook is clearly not my forte.

    Thank you.
    Anton
    If I offer a penny for your thoughts, will you put your two cents in?

  2. #2
    This should help. Edit the body text as required, and I suggest you make Outlook work offline before you run this and then Send/Receive manually.
    [vba]Public Sub ABT()

    Dim olNs As Outlook.NameSpace
    Dim olOutbox As Outlook.MAPIFolder
    Dim olItem As Object
    Dim olEmail As Outlook.MailItem

    Set olNs = GetNamespace("MAPI")
    Set olOutbox = olNs.GetDefaultFolder(olFolderOutbox)

    For Each olItem In olOutbox.Items
    If olItem.Class = olMail Then
    Set olEmail = olItem
    With olEmail
    .Body = "New body text"
    .Save
    .Send
    End With
    End If
    Next

    End Sub[/vba]

  3. #3
    VBAX Regular tactps's Avatar
    Joined
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    10
    Location
    You have made me very, very happy!

    Works a treat.

    Thanks
    If I offer a penny for your thoughts, will you put your two cents in?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •