Creating a button to submit a Word processing Form as an email Attachment
- From the developer tab select Command Button:
- Change the button’s name:
- Right click on the button and select edit:
- The button text now becomes editable, change it to what best describes the button. In this case, the text was changed to “Save Document and Send via Email”:
(The text was too long, so the button was widened to display all text.)
Set up the button to send the email when clicked:
- Right Click the button and choose view code:
A visual basic window will popup. This gives a place to put some code that will be executed when the button is clicked
- Place the following code:
Options.SendMailAttach = True
Such that it is within the button click sub routine:
- You may now close the Visual Basic window.
- Now , when the button is clicked, you computer’s default mail client will be opened with the form attached for sending via email.
Note that the method above does not allow for setting a recipient’s address in the opened mail client. If you would like to specify a recipient address and email subject, use the following code within the click subroutine:
Activedocument.HasRoutingSlip = True With Activedocument.RoutingSlip .Subject = "New subject goes here" .AddRecipient "Firstaddress@Mail.com" .AddRecipient "Secondaddress@Mail.com" .Delivery = wdAllAtOnce End With Activedocument.Route
© 2020 Vedesh Kungebeharry. All rights reserved.