Skip to content

Instantly share code, notes, and snippets.

@jcppkkk
Created August 30, 2013 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcppkkk/6391457 to your computer and use it in GitHub Desktop.
Save jcppkkk/6391457 to your computer and use it in GitHub Desktop.
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