I have created a filed called AttachmentsFld and it contains the full address and file name or each attachment separated by a ; Each of the documents have been converted to .pdf's I can run this for 1 attachment or multiple attachments. If it's multiple I set Me.MultiAttachFlag = -1
I get an error "Object doesn't support this property or method"
I then use the following code to create the email
I get an error "Object doesn't support this property or method"
I then use the following code to create the email
Code:
Public Function SendEmailWithAttach()
'------------------------------------ Send Email with Attachment -------------------
' This will create the PDF if the report is setup for it
Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
.To = CStr(Me.SendToEmailFld) '"john@optionsgrp.com.au"
.body = "Dear Sir / Madam" & Chr(10) & Chr(10) & "Please find enclosed a self-explanatory communication from XXXXXXXXXXXX." & Chr(10) & Chr(10) & Chr(10) & "Regards" & Chr(10) & Chr(10) & "XXXXXXXX"
.Subject = " " & Me.SubjectFld
If Me.MultiAttachFlag = -1 Then
.Attachments.Add (AttachmentsFld)
Else
.Attachments.Add (DocPathFld & DocFileNameFld)
End If
'********* What is the command to preview instead of send **** .Display *****
.Display
End With
Me.MultiAttachFlag = 0
Set oMail = Nothing
Set oLook = Nothing
End Function