Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.
Sub SendPdfInvoice() 'send pdf invoice Sheets("invoice").Select Range("MailBody").Select Dim MailToAdress As String MailToAdress = Range("MailTo").Value Dim MailBccAdress As String MailCcAdress = Range("MailCc").Value Dim MailSubject As String MailSubject = Range("MailSubject").Value ' creates and sends a new e-mail message with Outlook Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem Dim ToContact As Outlook.Recipient Set OLF = GetObject("", _ "Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) Set olMailItem = OLF.Items.Add ' creates a new e-mail message With olMailItem .Subject = Range("MailSubject").Value ' message subject 'Set ToContact = .Recipients.Add("email@example.com") ' add a recipient Set ToContact = .Recipients.Add(Range("MailTo")) ' add a recipient Set ToContact = .Recipients.Add(MailCcAddress) ' add a recipient ToContact.Type = olCC ' set latest recipient as CC .Body = "Also this text I would like to replace with the range in the excel sheet named MailBody instead of writing it here" & Chr(13) ' the message text with a line break .Attachments.Add Range("PdfPath").Value, olByValue, , _ "Attachment" ' insert attachment .OriginatorDeliveryReportRequested = False ' delivery confirmation .ReadReceiptRequested = False ' read confirmation .Send ' sends the e-mail message (puts it in the Outbox) End With Set ToContact = Nothing Set olMailItem = Nothing Set OLF = Nothing End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
9 Experts available now in Live!