Hello all,
The email code below works perfectly for me, but not on my clients' computers. What am I missing? All references are set correctly. Using Windows 7 and 8, Office 365 (Access 13). Sorry for the lack of indenting. TIA.
Code:
Dim stDocName As String
Dim MyPath As String
MyPath = "C:\abc moving\documents\" & Me.reportname
stDocName = "ConfirmationReport"
DoCmd.OutputTo acReport, stDocName, acFormatPDF, MyPath, True
Dim db As DAO.Database
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
Subjectline$ = "Thank you for choosing ABC Moving"
Set db = CurrentDb()
.To = Forms!moveinformation!EmailAddress
.SentOnBehalfOfName = "chris@abcmoving.com"
If Me.EmailAddress2 <> "" Then
.BCC = Forms!moveinformation!EmailAddress2
End If
.Subject = Subjectline$
If Me.TravelMove = True Then
MyMail.HTMLBody = DLookup("travelmessage", "emailmessages")
Else
MyMail.HTMLBody = DLookup("morningmessage", "emailmessages")
End If
.Attachments.Add ("c:\abc moving\documents\Boxes and Packing Supplies.pdf")
.Attachments.Add ("c:\abc moving\documents\Home Packing Tips.pdf")
.Attachments.Add ("c:\abc moving\documents\insurance and agreement.pdf")
.Attachments.Add MyPath
.Display
End With
End Sub