General discussion

Locked

A SendMail Macro in MS Word???

By maribeth_russell ·
I'm trying to set up a small macro in word that will automatically send the documents as an attachment in an Outlook message to a named recipient in my macro. I also want to include a subject line in my macro. I know this can be done with SendMail, but I'm having difficulty setting it up. Can any give me an example to go by?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

A SendMail Macro in MS Word???

by MG2k In reply to A SendMail Macro in MS Wo ...

You just need to fill in the blanks for subject, recipient, and attachments.

Sub CallCreateMail()
' This procedure shows how to pass an array of recipients,
' a subject line, a message body, and an array of attachments
' to the CreateMail procedure.
Dim strSubject As String
Dim strBody As String
Dim avarRecip(2) As Variant
Dim avarAttach(2) As Variant

' Create recipients array.
avarRecip(0) =
avarRecip(1) =
avarRecip(2) =

' Create attachments array.
avarAttach(0) =
avarAttach(1) =
avarAttach(2) =

' Create Subject line and message body.
strSubject =
strBody = "

If CreateMail(avarRecip, strSubject, strBody, avarAttach) = True Then
MsgBox "Congratulations! Your mail has been sent."
End If
End Sub

Collapse -

A SendMail Macro in MS Word???

by MG2k In reply to A SendMail Macro in MS Wo ...

You just need to fill in the blanks for subject, recipient, and attachments.

Sub CallCreateMail()
' This procedure shows how to pass an array of recipients,
' a subject line, a message body, and an array of attachments
' to the CreateMail procedure.
Dim strSubject As String
Dim strBody As String
Dim avarRecip(2) As Variant
Dim avarAttach(2) As Variant

' Create recipients array.
avarRecip(0) =
avarRecip(1) =
avarRecip(2) =

' Create attachments array.
avarAttach(0) =
avarAttach(1) =
avarAttach(2) =

' Create Subject line and message body.
strSubject =
strBody = "

If CreateMail(avarRecip, strSubject, strBody, avarAttach) = True Then
MsgBox "Congratulations! Your mail has been sent."
End If
End Sub

Collapse -

A SendMail Macro in MS Word???

by maribeth_russell In reply to A SendMail Macro in MS Wo ...

Your answer made sense. However, what if the document I'm placing this macro in is the actual attachment? How do I set up my attachment array to grab that actual document. My apologies - I know very little Visual Basic!

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums