Hello,
So I found a code that helped me send a report in outlook, in the body. However, some things are not transferring.
This is what a report looks like in the MS Access:
This is what the report looks like when transferring this report to outlook:
I'm okay with how it turned out, except I have a conditional formatting for the red/green text that says 'Tool is up/Tool is down'. I would like to get that conditional formatting to work on the email. Can anyone help me alter the following code to fix that?
Option Compare Database
Option Explicit
Private Sub Command28_Click()
Dim sFile As String, lFile As Long, sHtml As String
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
'Output the report to HTML in the temp directory
sFile = Environ$("TEMP") & "\DailyReport" & Format(Date, "yyyymmdd") & ".html"
DoCmd.OutputTo acOutputReport, "rptDailyReport", acFormatHTML, sFile
'Read in the HTML File
lFile = FreeFile
Open sFile For Input As lFile
sHtml = Input$(LOF(lFile) - 1, lFile)
Close lFile
'Put the file contents in the email body
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = "ThisPerson@email.com"
olMail.Subject = "Daily Report " & Date
olMail.HTMLBody = sHtml
olMail.Display
End Sub
I am running on Windows 10/Office 365.
Thanks in advance!