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.
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
|AD and Exchnage 2010 Photos||3||42|
|vba delte many shapes with same name||4||11|
|VBA If statement with filtered values||4||17|
|excel issue taking data and formating into columns question||4||19|