Send a Word Document As an Attachment

See how to send a document from within Word without blocking the Outlook window.

Last modified: 2014/10/14 | Accessed: 49.904  | #108
◀ Previous sample Next sample ▶
Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.

Word supports to send the active document as an attachment to Outlook, which you can send then with an email. However, the email window opens in a modal state, which means other Outlook windows are blocked as long as the email is being displayed. During that time you cannot look at your calendar, for instance, or copy some data from another email. There's more Outlook features that don't work, for instance, automatically adding your signature to the email created by Word.

This VBA macro for Word bypasses the limitations. Open the VBA editor in Word, add a standard module to the "Normal" project, and paste the code there. You can start the macro from the document by pressing alt+f8.

The macro expects Outlook to be running already. If the Word document is saved yet, the email with the attached document will be created immediately else you'll be asked to save the document first.

tip  How to add macros to Outlook
Public Sub AttachToEmail()
  Dim Outlook As Object
  Dim Mail As Object
  Dim Att As Object
  Dim Fullname As String
  Dim Dlg As Office.FileDialog

  If ActiveDocument.Saved Then
    Fullname = ActiveDocument.Fullname
    Set Dlg = Application.FileDialog(msoFileDialogSaveAs)
    If Dlg.SelectedItems.Count Then
      Fullname = Dlg.SelectedItems(1)
      ActiveDocument.SaveAs Fullname
      Exit Sub
    End If
  End If

  Set Outlook = GetObject(, "outlook.application")
  Set Mail = Outlook.CreateItem(0)
  Set Att = Mail.Attachments.add(Fullname)
  Mail.Subject = Att.DisplayName
End Sub
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
email  Send a message