Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.
Option Compare Database Option Explicit Sub EmailBookings() Dim OutApp As Object Dim OutMail As Object Dim strbody As String Dim SigString As String Dim Signature As String Dim Bkinglist As String Bkinglist = Environ("USERPROFILE") & "\My Documents\test.pdf" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) strbody = "<B>Hi,</B><br>" & _ "Please review the attached PDF booking list.<br>" & _ "Let me know if you have any queries.<br>" & _ "<br><br><B>Thank you</B>" SigString = Environ("appdata") & _ "\Microsoft\Signatures\Personal.htm" If Dir(SigString) <> "" Then Signature = GetBoiler(SigString) Else Signature = "" End If On Error Resume Next With OutMail .To = "firstname.lastname@example.org" .CC = "" .BCC = "" .Subject = "Booking List" .HTMLBody = strbody & "<br>" & Signature .Attachments.Add Bkinglist .Display ' .Send End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub Function GetBoiler(ByVal sFile As String) As String 'Dick Kusleika Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2) GetBoiler = ts.readall ts.Close End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.