Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.