![](https://gotkey.net/wp-content/uploads/2023/11/How-to-apply-a-button-to-send-email-with-current-Word-file-attached-4.jpg)
If you find yourself frequently sending emails from a Word document via Outlook and attaching the current Word file, you can streamline this process by creating a custom button. This button allows you to send an email with a simple click, eliminating the need to open Outlook separately. In this article, I’ll guide you through a quick and easy solution.
Applying the “Send Email with Current Word File Attachment” Button:
Follow these steps within your Word document:
- First, create a command button by clicking on Developer > Legacy Tools > Command Button (ActiveX Control), as shown in the screenshot:
- Select the button and click on Properties in the Developer tab. In the Properties pane, enter the desired caption text in the Caption field, as shown in the screenshot:
- Close the Properties pane. Right-click on the button and choose View Code:
- In the Microsoft Visual Basic for Applications window, copy and paste the following code into the middle of the existing commands:
Dim xOutlookObj As Object
Dim xEmail As Object
Dim xDoc As DocumentApplication.ScreenUpdating = False
Set xOutlookObj = CreateObject(“Outlook.Application”)
Set xEmail = xOutlookObj.CreateItem(olMailItem)
Set xDoc = ActiveDocumentxDoc.Save
With xEmail
.Subject = “Fax-data”
.Body = “This is a test email.”
.To = “yy@addin99.com”
.Importance = olImportanceNormal
.Attachments.Add xDoc.FullName
.Display
End WithSet xDoc = Nothing
Set xEmail = Nothing
Set xOutlookObj = NothingApplication.ScreenUpdating = True
Note: Modify the subject, body, or recipient’s address in the code according to your preferences.
- Save and close this code window. Press Design Mode to exit design mode. Now, when you click the button you created, an email will be generated with the current Word document attached, as shown below:
How to apply a button to send email with current Word file attached
- Finally, click Send to dispatch this email.
By following these steps, you’ve successfully added a button to your Word document, providing a convenient way to send emails with the current document attached.