Sending documents created in Word to the same recipients via email is a standard task. Automating this repetitive work with VBA significantly reduces operation time.
This article introduces a method to create a macro that, when executed in Word, automatically opens a new Outlook email window, populates the destination, CC, and body text, and attaches the currently active Word file (converted to a macro-free .docx format).
Capabilities of This Macro
- Automatically opens a new Outlook email window.
- Automatically enters multiple addresses in the To and CC fields.
- Automatically inserts template text into the body.
- Converts the currently open Word file to
.docxformat and attaches it. - Stops at the display stage (does not send automatically), allowing for final verification.
Required Environment
- Microsoft Word (Macro-enabled: .docm)
- Microsoft Outlook (Installed and set as the default mail client)
- Windows (Environment where VBA is available)
VBA Code
Paste the following code into a standard module in the Word Macro Editor (Alt + F11).
Sub SendEmailWithOutlookAsDocx()
Dim objOutlook As Object
Dim objMail As Object
Dim currentDocumentPath As String
Dim tempDocxPath As String
' Get full path of current Word document
currentDocumentPath = ActiveDocument.FullName
' Change extension to .docx and save as temp file
tempDocxPath = Replace(currentDocumentPath, ".docm", ".docx")
ActiveDocument.SaveAs2 FileName:=tempDocxPath, FileFormat:=wdFormatXMLDocument, CompatibilityMode:=wdCurrent
' Create Outlook application object
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0) ' 0 = olMailItem
' Configure Email
With objMail
.To = "a_mori@mori.com; b_komori@mori.com"
.CC = "c_nakamori@mori.com; d_oumori@mori.com"
.Subject = "Regarding the Meeting"
.Body = "Team," & vbCrLf & vbCrLf & _
"Thank you for participating in the meeting." & vbCrLf & _
"I have attached the summary file." & vbCrLf & vbCrLf & _
"I will contact you once the next meeting is decided." & vbCrLf & vbCrLf & _
"Mori"
' Attach file
.Attachments.Add tempDocxPath
' Display email (do not send)
.Display
End With
' Release objects
Set objMail = Nothing
Set objOutlook = Nothing
' Delete temp file (Uncomment if necessary)
' Kill tempDocxPath
End Sub
How to Execute
- Save the Word file in
.docmformat. - Open the Macro Editor (Alt + F11), paste the code above, and save.
- Run the macro (Alt + F8 -> Select Macro Name).
- A new Outlook email window will open automatically.
Customization of Recipients and Body
- To / CC: Enter the target email addresses in the
.Toand.CCsections. Multiple addresses can be specified by separating them with semicolons. - Subject / Body: The
.Subjectand.Bodysections can be edited to serve as a template. - Attachment: Since the file is automatically converted to
.docx, it can be sent as a safe file not containing macros.
Important Notes and Supplements
- Outlook must be the default email client.
- The file converted to
.docxis temporarily saved in the same folder. - The email is not sent automatically. Changing
.Displayto.Sendallows for automatic transmission.
Summary
Utilizing this macro allows routine email transmission tasks to be completed with a single click.
Eliminating the steps of “opening the file -> launching email -> typing the body -> attaching the file” significantly improves work efficiency. Automation via VBA is highly effective for repetitive tasks. Please incorporate this into business workflows.
