Outlook email security issue

I'm using the following code to send an email via a command button on a form.  But the sender gets a security warning (see attached file).  Is there a way to avoid this?  Maybe different code?

Here's the current onclick code:

Private Sub Command116_Click()

   Dim olApp As Object
   Dim objMail As Object
   
   Dim RegHrs, OThrs, totHrs
    RegHrs = Format([txtTotRegHrs], "#.00")
    OThrs = Format([txtTotOThrs], "#.00")
    totHrs = Format([txtTotTimeCardHrs], "#.00")

   On Error Resume Next 'Keep going if there is an error
   Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open

    If Err Then 'Outlook is not open
       Set olApp = CreateObject("Outlook.Application") 'Create a new instance
    End If
  'Create e-mail item
   Set objMail = olApp.CreateItem(olMailItem)

   With objMail
   'Set body format to HTML
     .BodyFormat = olFormatHTML
     .To = Me.txtApproverEmail
     .Subject = "Time Card Approval Notification For Employee - " & [txtEmployeeName] & " - Dated " & [txtTranxDateHeader]
     .HTMLBody = "<htmltags>Regular Hours = " & RegHrs & "<br>Overtime Hours = " & OThrs & "<br>Total Hours = " & totHrs & "<br></htmltags>"
     .send
   End With

   Me.chkbxSubmittedToApprover = True

  MsgBox "Request for approval has been sent.  Be sure to close the form."

 End Sub
SecurityWarning.jpg
SteveL13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AccessGuy1763Commented:
I'm not saying this list is comprehensive, but from my experience here's a couple of ways to deal with this:

#1 - This message does not show up if Outlook detects a valid Antivirus installation.  You can  check this by going to Tools > Trust Center > Programmatic Access.  On the very bottom, it should say Antivirus Status: Valid or Invalid.  If it says invalid, Outlook will prompt.  If it says Valid, it will not.  I know this is true at least for Outlook 2007.

#2 - This is not my favorite resolution as it makes the computer more vulnerable, but you can install 3rd party apps which basically click the message automatically.  I think one I've used before is called "ClickYes", but there's a number available you could check out, I'm sure.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
...Or use one of the many Access email systems that bypass Outlook directly,
for example:
http://www.fmsinc.com/MicrosoftAccess/Emails.asp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.