Created
August 30, 2013 16:09
-
-
Save jcppkkk/6391457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub SendMessage() | |
Dim objOutlook As Outlook.Application | |
Dim objOutlookMsg As Outlook.MailItem | |
Dim objOutlookRecip As Outlook.Recipient | |
Dim objOutlookAttach As Outlook.Attachment | |
' Create the Outlook session. | |
Set objOutlook = CreateObject("Outlook.Application") | |
' Create the message. | |
Set objOutlookMsg = objOutlook.CreateItem(olMailItem) | |
With objOutlookMsg | |
.Display | |
' Add the To recipient(s) to the message. | |
Set objOutlookRecip = .recipients.Add("Nancy Davolio") | |
objOutlookRecip.Type = olTo | |
' Add the CC recipient(s) to the message. | |
Set objOutlookRecip = .recipients.Add("b b ") | |
objOutlookRecip.Type = olCC | |
' Add the BCC recipient(s) to the message. | |
Set objOutlookRecip = .recipients.Add("a") | |
objOutlookRecip.Type = olBCC | |
.recipients.ResolveAll | |
' Resolve each Recipient's name. | |
'For Each objOutlookRecip In .recipients | |
' objOutlookRecip.Resolve | |
'Next | |
.recipients.Add (" ") | |
'.recipients.Remove (.recipients.Count - 1) | |
' Should we display the message before sending? | |
End With | |
Set objOutlook = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment