MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
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", localhost) 'Set objOutlook = Outlook.Application ' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem) With objOutlookMsg ' Add the To recipient(s) to the message. Substitute ' your names here. Set objOutlookRecip = .Recipients.Add("email@example.com") '<--Recipient's name or email address objOutlookRecip.Type = olTo ' Add the CC recipient(s) to the message. 'Set objOutlookRecip = .Recipients.Add("CC Recipient Name") 'objOutlookRecip.Type = olCC ' Set the Subject, Body, and Importance of the message. .Subject = "Blah Blah Blah" '<--Subject .Body = "Dear Tom" & vbCr & vbCr '<--Email Body text. .Importance = olImportanceHigh 'High importance 'Add attachments to the message. 'Set objOutlookAttach = .Attachments.Add("C:\Earth.jpg") '<-- Add as many attachments as you need here. 'Set objOutlookAttach = .Attachments.Add("C:\TextFile.txt") ' Resolve each Recipient's name. For Each objOutlookRecip In .Recipients If Not objOutlookRecip.Resolve Then objOutlookMsg.Display End If Next 'Send email without viewing it. '.Send 'Dispay email before sending. .Display End With 'Cleanup Code Set objOutlookMsg = Nothing Set objOutlook = Nothing Set objOutlookRecip = Nothing Set objOutlookAttach = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.