Automating the sending of email using File --->SendTo in Code.....

M

Michael Martin

Dear Colleagues:

I have an App that generates form letters with some formatting, including a
scanned signature. In some cases the recipient should receive the letter as
email. I know you can use Word's File--->SendTo menuitem to send a Word
document as an email message manually, but how could I do that in VBA code.
I've searched the Office and Word object Models and I can't seem to find an
equivalent method with the associated parameters that would seem to be
required (who email is from, who its going to, subject line, etc.)

Can anyone point me in the right direction?

Thanks.
 
P

Peter Huang

Hi Michael,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to automation the
process that word sent mail.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

Yes, the word object modal did not expose the properties for us.

This MailEnvelope is very limited and we had to reference Outlook in order
to set the properties of that email item.
Using a reference to Outlook you can then access the email that will be
sent from word and manipulate the properties of that email message.

Here is some sample code to demonstrate this idea :
Sub SendMail()
Dim OI As MailItem
With Application.ActiveDocument.MailEnvelope
.Introduction = "Please read and reply."
Set OI = .Item
OI.To = "emailaddress"
OI.Subject = "Email from Word"
OI.Send
End With
End Sub

Or you may take a look at the link below, which introduce two methods, you
may take a look.
http://word.mvps.org/FAQs/InterDev/SendMail.htm

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang

Hi Michael,

Have you tried my suggestion?
If you still have any question on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top