farhanleos
Registered User.
- Local time
- Yesterday, 16:14
- Joined
- Oct 19, 2017
- Messages
- 38
Sir,
i am working or reports on my DB
i am able to convert reports in pdf format with specific file name and save that file in Document folder
Now my concern is to send that pdf report to no of Recepients
with Subject and Body of Email
i tried from morning but not succeed fully , here is my last mess up script
kindly anybody can help me
Private Sub Command45_Click()
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
Dim rst As DAO.Recordset
Dim strEmailAddress
Dim EmailApp, NameSpace, EmailSend As Object
'set variables
strReportName = "006-10 Years Business Plan"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = "mailaddress"
EmailSend.Subject = "EMERGENCY"
EmailSend.Attachment.Add strPathUser
EmailSend.Display
End Sub
CODE TO CONVERT AND SAVE THE REPORT IS
Private Sub Command43_Click()
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
'set variables
strReportName = "006-10 Years Business Plan"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
'launch excel file
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
Shex.Open (strFilePath)
End Sub
i am working or reports on my DB
i am able to convert reports in pdf format with specific file name and save that file in Document folder
Now my concern is to send that pdf report to no of Recepients
with Subject and Body of Email
i tried from morning but not succeed fully , here is my last mess up script
kindly anybody can help me
Private Sub Command45_Click()
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
Dim rst As DAO.Recordset
Dim strEmailAddress
Dim EmailApp, NameSpace, EmailSend As Object
'set variables
strReportName = "006-10 Years Business Plan"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = "mailaddress"
EmailSend.Subject = "EMERGENCY"
EmailSend.Attachment.Add strPathUser
EmailSend.Display
End Sub
CODE TO CONVERT AND SAVE THE REPORT IS
Private Sub Command43_Click()
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
'set variables
strReportName = "006-10 Years Business Plan"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
'launch excel file
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
Shex.Open (strFilePath)
End Sub