i have a piece of code which develops an email in outlook, it worls great. BUT i need the attachment to be in the body of the email.
Any Suggestions (code below).
Private Sub cmdSend_Click()
Dim strEmail, HTML As String
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strEmail = txtEmail
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<P><font size=""3"" face=""Optima"">"
HTML = HTML & ITSQFDocumentName & " received from " & ProjectServiceDesigner & _
":" & "<Strong>" & " '" & ProjectName & "'" & "</Strong>" & "- PAR "
If IsNull(ProjectPAR) Then
HTML = HTML & "TBA " & Chr(13) & "<BR>"
Else
HTML = HTML & ProjectPAR & Chr(13) & Chr(13) & "<BR>"
End If
If Not IsNull(ProjectLiveDate) Then
HTML = HTML & "Go Live " & ProjectLiveDate & Chr(13) & "<BR></P>"
End If
HTML = HTML & "<P>" & ProjectSummary & Chr(13) & "</P>"
HTML = HTML & "<P>" & ITSQFServRecommendation & Chr(13)
HTML = HTML & ITSQFQualityGate & Chr(13)
If Not IsNull(ITSQFList) Then
HTML = HTML & "with the following points to note:" & Chr(13) & "<BR>"
End If
HTML = HTML & ITSQFList & Chr(13) & "<BR> </P>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
objEmail.HTMLBody = HTML
'***creates and sends email
With objEmail
.To = ITSQFEmail
.CC = "email@email.com"
.Subject = "ITSQF Submission"
.HTMLBody = HTML
.Attachments.Add (ITSQFDocumentAddress)
.Send
End With
Set objEmail = Nothing
DoCmd.Close
End Sub
Any Suggestions (code below).
Private Sub cmdSend_Click()
Dim strEmail, HTML As String
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strEmail = txtEmail
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<P><font size=""3"" face=""Optima"">"
HTML = HTML & ITSQFDocumentName & " received from " & ProjectServiceDesigner & _
":" & "<Strong>" & " '" & ProjectName & "'" & "</Strong>" & "- PAR "
If IsNull(ProjectPAR) Then
HTML = HTML & "TBA " & Chr(13) & "<BR>"
Else
HTML = HTML & ProjectPAR & Chr(13) & Chr(13) & "<BR>"
End If
If Not IsNull(ProjectLiveDate) Then
HTML = HTML & "Go Live " & ProjectLiveDate & Chr(13) & "<BR></P>"
End If
HTML = HTML & "<P>" & ProjectSummary & Chr(13) & "</P>"
HTML = HTML & "<P>" & ITSQFServRecommendation & Chr(13)
HTML = HTML & ITSQFQualityGate & Chr(13)
If Not IsNull(ITSQFList) Then
HTML = HTML & "with the following points to note:" & Chr(13) & "<BR>"
End If
HTML = HTML & ITSQFList & Chr(13) & "<BR> </P>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
objEmail.HTMLBody = HTML
'***creates and sends email
With objEmail
.To = ITSQFEmail
.CC = "email@email.com"
.Subject = "ITSQF Submission"
.HTMLBody = HTML
.Attachments.Add (ITSQFDocumentAddress)
.Send
End With
Set objEmail = Nothing
DoCmd.Close
End Sub