Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.
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("firstname.lastname@example.org") ' 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
|Excel VBA get Access table names with ADO||2||19|
|Outlook 2013 License Question||8||24|
|VBA: Insert new column and remove first character of string||5||18|
|How to copy formulas in 1 column through manual page breaks in Excel||1||19|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
8 Experts available now in Live!