Converting report to PDF and attach it to email

crxftw

Registered User.
Local time
Today, 12:31
Joined
Jun 9, 2011
Messages
81
Hello, I've been trying to find solutions how I am able to convert currently opened report to PDF and attach it to outlook e-mail. I am using Access2k10 and I tried EmailDatabaseObject macro function and SendObject through VBA but these have some flaws that I can't have. I need message body to be either from template file (message text is different which depends on area to where email will be sent). Both that I mentioned don't let me format body text in html which i need as I must get logo to email together with long text.

Any suggestions how it's the easiest way to do these two (convert to pdf and attach to outlook) operations with one button click?

Regards
 
I have Access 2007 so I don't know if code would be much different, but thought it might help you (note my Record ID includes text):

Private Sub Email_Click()
On Error GoTo Err_Email_Click

Dim strReport As String
Dim stEmail As String
Dim stSubject As String

strReport = "my rpt"
Me.Refresh
strWhere = "[RecordID] = """ & Me.[RecordID] & """"
DoCmd.OpenReport "my rpt", acViewPreview, , strWhere
Reports(strReport).Visible = False
stEmail = "my email here"
stSubject = "Inspection Sheet " & Me!RecordID & ""

DoCmd.SendObject acSendReport, strReport, acFormatPDF, stEmail, , , stSubject, , , False

Exit_Email_Click:
Exit Sub

Err_Email_Click:
MsgBox Err.Description
Resume Exit_Email_Click
End Sub
 
Unfortunately DoCmd.SendObject limits to max 255 characters per message so I am not able to used that.
 

Users who are viewing this thread

Back
Top Bottom