(sorry if this it the wrong section, Mods please move if it is, Thanks)
Im new to VBA and to this site, First of all I Just want to say Hello to everyone and Thanks in advance.
Second im having a little issue, Everyday I need to send different reports to a bunch of different persons every hour... I had several macros that did it for me, But Then they wanted me to include a e-mail body that was more than 255chars, so i had to go VBA and i have this (for every set of persons and Reports):
Private Sub Command38_Click()
On Error GoTo ErrorHandler
DoCmd.SendObject acReport, "REPORT NAME", "Extension", "EMAILS", "", "SUBJECT", "EMAIL BODY", True, ""
ExitHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
ErrorHandler:
Select Case Err
Case 2501
MsgBox "Report Not Sent"
DoCmd.Hourglass False
Resume ExitHandler
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
End Sub
so everything is good, but NOW they want the body of the email to contain another paragraph totally separated from the first one and they want it highlited and also in Red, How can i add Html to this or do i have to use another method?
I have tried this:
Public Sub TestEmail()
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = "email address here"
''.cc = ""
''.bcc = ""
.Subject = "HTML TEST"
.HTMLBody = "<HTML><body>" & _
"<font color='red'>This is a test</font>" & _
"<body><HTML>" & _
Chr(10) & Chr(13) & Now
''.Attachments.Add (strZip)
.DeleteAfterSubmit = True 'to not save in sent bin
''.Display
.Send
End With
End Sub
But it keeps on giving me errors, about objects not being defined, i have tried everything i read and im just frustrated, Like i said before im a noob, please go easy if this is something stupid, I have been using access/bva for about one week now, but i been reading a lot, looking forward to learn some more and then be a contribuyent instead of a questioner.'
Thanks