John-
For the SendReportHTML function, is that possible to send report from a specific record? For example: to send a report (rptItineraryPart) with ID=Me.Parent.GroupBookingID. By the way, here's again, the function you sent to me before:
Sub SendReportHTML(strReportName As String, strEmail As String, strSubject As String)
Dim strHTML As String, strInput As String
Dim strEmailAddress As String
Const olMailItem = 0
Const olFormatHTML = 2
Dim objOlApp As Object, objOlMail As Object
' Output the 1-page report to html
DoCmd.OutputTo acOutputReport, strReportName, acFormatHTML, "C:\Test\TestReport.html"
' Open the resulting file
Open "C:\Test\TestReport.html" For Input As #1
' Create an Outlook session
Set objOlApp = CreateObject("Outlook.Application")
' Start a new email
Set objOlMail = objOlApp.CreateItem(olMailItem)
' Read in the created HTML and put together an output string
Do While Not EOF(1) ' Loop until end of file
' Get a line from the file
Input #1, strInput
' Add it to the accumulated HTML
strHTML = strHTML & strInput
Loop
' Close the file
Close #1
' Use the mail item for several tasks
With objOlMail
.To = strEmail
.Subject = strSubject
.BodyFormat = olFormatHTML
.HTMLBody = strHTML
.Send
End With
' Clear the objects
Set objOlMail = Nothing
Set objOlApp = Nothing
End Sub
Dim strHTML As String, strInput As String
Dim strEmailAddress As String
Const olMailItem = 0
Const olFormatHTML = 2
Dim objOlApp As Object, objOlMail As Object
' Output the 1-page report to html
DoCmd.OutputTo acOutputReport, strReportName, acFormatHTML, "C:\Test\TestReport.html"
' Open the resulting file
Open "C:\Test\TestReport.html" For Input As #1
' Create an Outlook session
Set objOlApp = CreateObject("Outlook.Application")
' Start a new email
Set objOlMail = objOlApp.CreateItem(olMailItem)
' Read in the created HTML and put together an output string
Do While Not EOF(1) ' Loop until end of file
' Get a line from the file
Input #1, strInput
' Add it to the accumulated HTML
strHTML = strHTML & strInput
Loop
' Close the file
Close #1
' Use the mail item for several tasks
With objOlMail
.To = strEmail
.Subject = strSubject
.BodyFormat = olFormatHTML
.HTMLBody = strHTML
.Send
End With
' Clear the objects
Set objOlMail = Nothing
Set objOlApp = Nothing
End Sub
Best Regards,
Kevin
zhaoliqingoffice@163.com
__._,_.___
Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar