In previous versions of Word (pre-Office 2007) you had the ability to send the contents of your current document as the contents of your email. In Word 2007/2010 you initially only have the option to send it as an attachment. To add that functionality again you can use this tip.
However, you’d still be in the Word environment. The drawback of this, is that you are missing some Outlook features such as;
- choosing the Sent Items folder
- convenient access to your signatures if you only have 1 mail account
- inserting Business Cards
- inserting Quick Parts you saved in Outlook
- custom VBA code
- some addins that you have installed for Outlook won’t function properly
This guide will explain how you can mimic the “Send to Mail Recipient” feature by using VBA code and allow you to work in an Outlook environment, giving you access to the features you need.
Enable the Developer tab in Word
This time we will work from Word instead of Outlook and before we can create a macro in Word we have to enable the Developer tab on the Ribbon. To do this press the Office logo in the top left corner and click Word Options.
Launching Word Options from the Office menu.
In Word Options select to enable the Developer tab on the Ribbon.
Show Developer tab in Ribbon.
As I already provide you with the code, creating the macro is easy. The code has been tested with Word and Outlook 2007 on Windows XP and on Windows Vista.
To launch the Visual Basic Editor select the Developer tab in the Ribbon and click Visual Basic Editor.
Launching the Visual Basic Editor from the Developer tab.
This will open a new screen. Select Normal in the left top pane and choose Insert-> Module to create a new module dedicated to this macro. Select the newly created module in the left pane and rename it to "DocAsMail" by changing the Properties value in the pane underneath. Copy and paste the code below to the module.
Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code
The code copied in the Visual Basic Editor.
Since this macro also uses Outlook functionality to create the mail we must add the reference to the project. To do this choose Tools-> References… and select Microsoft Outlook 12.0 Object Library (or 14.0 when using Outlook 2010). After this press OK.
Now we debug the code by choosing Debug-> Compile Normal. You shouldn’t be getting errors if you’ve done everything correctly.
If you do get errors retrace your steps and also verify that any previous code you might have in Normal-> Microsoft Word Objects-> ThisDocument is correct. Debug until you’ve solved the errors (the code provided works correctly without any modifications).
To be able to run the code without setting your macro security level to medium I recommend that you sign your code which is a very easy process and only takes a minute. In this case make sure you sign the code in Word and not in Outlook.
Create a button for the macro
You can run the macro by selecting the Developer tab on the Ribbon and choose Macros. Select the SendDocAsMail macro and press Run. However the easiest way to access and use the macro is to create a button for it.
- Press the down arrow on the Quick Access Toolbar (QAT) and select More Commands…
- In the "Choose commands from" dropdown list choose Macros
- Select Normal.DocAsMail.SendDocAsMail and press the Add button
- Press Modify to change the Display name and icon
- Press OK to close the open dialogs.
The Send As Doc icon in the Toolbar.
Using the macro
To send the current document as an email press the icon. You’ll get prompted to write a short intro.
When you press OK the short intro will be placed above your default mail signature (if you have one). The document itself is placed below your signature divided by a horizontal line.
When you press Cancel or OK without writing a short intro the current document will show up in the message body without your signature or a horizontal line.