hortizjr59
Registered User.
- Local time
- Today, 03:46
- Joined
- Sep 6, 2011
- Messages
- 30
I obtained to code below from this forum made a few changes to it and it works great, does exactlyu what I want it to do; outputs the current record into the body of an email. Well it also prints the report each and every time. I have reviewed the code below and although I am only a novice at this I cannot locate where the code is telling the report to output to the printer. Any help will be appreciated.
Private Sub Command135_Click()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
stDocName = "ReportEmailNoticeofAssigned"
stFilename = "C:\Documents and Settings\hortiz\My Documents\Hector\myreport.html"
strWhere = "[Improvement No] = " & Me.[Improvement No]
DoCmd.OpenReport stDocName, acNormal, , strWhere
DoCmd.OpenReport "ReportEmailNoticeofAssigned", acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, stDocName, acFormatHTML, stFilename
DoCmd.Close acReport, stDocName
Open "C:\Documents and Settings\hortiz\My Documents\Hector\myreport.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
End Sub
Thanks:
Stumped
Private Sub Command135_Click()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
stDocName = "ReportEmailNoticeofAssigned"
stFilename = "C:\Documents and Settings\hortiz\My Documents\Hector\myreport.html"
strWhere = "[Improvement No] = " & Me.[Improvement No]
DoCmd.OpenReport stDocName, acNormal, , strWhere
DoCmd.OpenReport "ReportEmailNoticeofAssigned", acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, stDocName, acFormatHTML, stFilename
DoCmd.Close acReport, stDocName
Open "C:\Documents and Settings\hortiz\My Documents\Hector\myreport.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
End Sub
Thanks:
Stumped
