Set myNewFolder = myFolder. Set myFolder = myNameSpace.GetDefaultFolder(olFolderDrafts) Set myNameSpace = Outlook.GetNamespace("MAPI") If FileExists(pathStr & BACode & "\" & fileStr) Then Mail.Body = Sheets("Sheet1").Range("A1").TextįileStr = wsMLOG.Range("C" & i).Value & ".pdf" Mail.Subject = wsMLOG.Range("B" & i).Value & " " & wsMLOG.Range("C" & i).Value Mail.To = wsMLOG.Range("L" & i).Value & " " & wsMLOG.Range("M" & i).Value & " " & wsMLOG.Range("N" & i).Value & " " & wsMLOG.Range("O" & i).Value & " " & wsMLOG.Range("P" & i).Value & " " & wsMLOG.Range("Q" & i).Value & " " & wsMLOG.Range("R" & i).Value & " " & wsMLOG.Range("S" & i).Value & " " & wsMLOG.Range("T" & i).Value & " " & wsMLOG.Range("U" & i).Value & " " & wsMLOG.Range("V" & i).Value & " " & wsMLOG.Range("W" & i).Value & " " & wsMLOG.Range("X" & i).Value & " " & wsMLOG.Range("Y" & i).Value & " " & wsMLOG.Range("Z" & i).Value & " " & wsMLOG.Range("AA" & i).Value & " " & wsMLOG.Range("AB" & i).Value Set Mail = objOutlook.CreateItem(olMailItem) Set rngLessHeader = gf_rngGet_TableData_Range(rngTable1)ĪdminWeek = MsgBox("Admin Week?", vbYesNo) Set rngTable1 = wsMLOG.Range("A4").CurrentRegionĭim rngLessHeader As Excel.Range, rngRows As Long, rngRow1 As Long
Excel vba create outlook email draft code#
'Microsoft Outlook XX.X Object Library is required to run this code
![excel vba create outlook email draft excel vba create outlook email draft](http://i.ytimg.com/vi/3HOsWA1-quQ/maxresdefault.jpg)
Excel vba create outlook email draft how to#
MsgBox ("you Mail has been sent to " & SendID) Here’s how to do that: First, go ahead and open Microsoft Outlook. However, when the Outlook draft is created, it creates 1 more draft than the number of people intended to be on the e-mail. ‘it will be changed to the correct cid when its sent. ‘change the src property to ‘cid:your image filename’ ‘Now add it to the Html body using image name Attachments.Add "C:\Users\Sumit Jain\Pictures\11\city.jpg", olByValue, 0 ‘add the image in hidden manner, position at 0 will make it hidden Subject = mainWB.Sheets("Mail").Range("B3").Valueīody = mainWB.Sheets("Mail").Range("B4").Value SendID = mainWB.Sheets("Mail").Range("B1").ValueĬCID = mainWB.Sheets("Mail").Range("B2").Value Set olMail = otlApp.CreateItem(olMailItem) Set otlApp = CreateObject("Outlook.Application") Ides is to attach the image in hidden manner and later add it to using image name in the HtmlBody. In this tutorial you will learn how to add an image in the mail body or message and send it from Microsoft Outlook. ( I recommend you first read these articles to understand the basics if you are new to this) In previous articles you have learned about Send a Simple Mail From MS Outlook Using Excel and how to send Attachment With the Mail MS Outlook Using Excel.