This
article describes how to use a command-line switch to create a new e-mail
message and to populate the
To field automatically in
Microsoft Office Outlook 2007 and in Microsoft Office Outlook 2003 by using one of the following two methods:
| • | Using a desktop shortcut. |
| • | Using the shell command. |
Microsoft provides programming examples for illustration only,
without warranty either expressed or implied. This includes, but is not limited
to, the implied warranties of merchantability or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language that is being demonstrated and with the tools that are used to create
and to debug procedures. Microsoft support engineers can help explain the
functionality of a particular procedure, but they will not modify these
examples to provide added functionality or construct procedures to meet your
specific requirements.
Using a desktop shortcut
To create a shortcut that automatically pre-addresses a new e-mail
message, follow these steps:
| 1. | Right-click a blank area in your Windows desktop, point to
New, and then click Shortcut. |
| 2. | In the command location box, type (with the quotation
marks) one
of the following commands:
| • | In Outlook 2007 "C:\Program
Files\Microsoft Office\Office12\Outlook.exe" /c ipm.note /m full
e-mail name | | • | In Outlook 2003 "C:\Program
Files\Microsoft Office\Office11\Outlook.exe" /c ipm.note /m full
e-mail name |
where full e-mail name is the complete
e-mail address of the recipient.
In this example, the command-line
location would be as follows: "C:\Program Files\Microsoft Office\Office11\Outlook.exe" /c ipm.note /m JohnDoe@msn.com Note This example assumes that Outlook 2003 is installed in the
default setup location. You may have to modify the path if you did not install
Outlook 2003 in the default setup location. |
| 3. | Type a name for the shortcut, for example, type
Mail to John Doe. |
| 4. | Click Finish. |
Note If you want to use a custom form in your desktop shortcut, use
the message class of the custom form instead of using the message class of
IPM.Note. For example, if the custom form that you want to use has a display
name of "MyForm," (without quotation marks) the message class would be
IPM.Note.MyForm. In this example, the command-line location would be as follows:
"C:\Program Files\Microsoft Office\Office11\Outlook.exe" /c
ipm.note.myform /m JohnDoe@msn.com
Using the shell command
To automatically create a new pre-addressed
Outlook 2007 or
Outlook 2003 e-mail message by using the
shell command, follow these steps.
In
Outlook 2007
| 1. | Start Microsoft Office Word 2007. |
| 2. | On the Developer tab, click
Macro. |
| 3. | In the Macro name box, type
SendMail, and then click
Create. |
| 4. | Type the following sample code in the code editor, where
full e-mail name is the complete e-mail address of
the recipient. Shell "C:\Program Files\Microsoft Office\Office12\Outlook.exe /c ipm.note
/m full e-mail name" In this example, type Shell "C:\Program Files\Microsoft
Office\Office11\Outlook.exe /c ipm.note /m
JohnDoe@msn.com. |
| 5. | On the File menu, click Close and
Return to Microsoft Word. |
| 6. | On the Developer menu, click
Macro. |
| 7. | Click the SendMail macro, and then click
Run. The SendMail macro creates a new e-mail message that is pre-addressed to the
recipient that you typed in step 4. |
In
Outlook 2003| 1. | Start Microsoft Office Word 2003. |
| 2. | On the Tools menu, point to
Macro, and then click Macros. |
| 3. | In the Macro name box, type
SendMail, and then click
Create. |
| 4. | Type the following sample code in the code editor, where
full e-mail name is the complete e-mail address of
the recipient. Shell "C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note
/m full e-mail name" In this example, type Shell "C:\Program Files\Microsoft
Office\Office11\Outlook.exe /c ipm.note /m
JohnDoe@msn.com. |
| 5. | On the File menu, click Close and
Return to Microsoft Word. |
| 6. | On the Tools menu, point to
Macro, and then click Macros. |
| 7. | Click the SendMail macro, and then click
Run. The SendMail macro creates a new e-mail message that is pre-addressed to the
recipient that you typed in step 4. |
If Outlook 2007 or
Outlook 2003 is not running, you may experience a
delay while the Microsoft Windows Messaging System starts.
Note The
shell command is very restrictive. You may have more automation
features if you use Microsoft Visual Basic for Applications (VBA) or Microsoft
Visual Basic Scripting Edition (VBScript).
Because of Outlook 2003
security enhancements, you cannot use a command-line to automatically populate
the subject or the body of e-mail messages.
For additional
information, click the following article number to view the article in the
Microsoft Knowledge Base:
823923 (http://support.microsoft.com/kb/823923/)
You
cannot use the /select switch to start Outlook 2003