title: Disable outlook security settings using VBA
body: <p>I am trying to auto email a report from access using VBA in a macro. The report is sent from Access2007 by outlook2007. When the report is being sent, I get a security message from outlook saying "a program is trying to access your Address book or Contacts" or "a program is trying to access e-mail addresses you have stored in Outlook..." . This message is a problematic for me because I want to use windows task scheduler to automatically send the report without any human interaction.So I want to disable this security notification. I searched on Google and here is the code I have so far but giving me errors and I am not sure what else I should do. Thanks for your help in advance. I am a beginner programmer. The error is </p>
  
  <pre><code>Public Sub Send_Report()
  Dim strRecipient As String
  Dim strSubject As String
  Dim strMessageBody As String
  Dim outlookapp As Outlook.Application
  
  Set outlookapp = CreateObject("Outlook.Application")
  
  OlSecurityManager.ConnectTo outlookapp   'error is here says object required
  
  OlSecurityManager.DisableOOMWarnings = True
  On Error GoTo Finally
  
  strRecipient = "example@yahoo.com"
  strSubject = "Tile of report"
  strMessageBody = "Here is the message."
  
  DoCmd.SendObject acSendReport, "Report_Name", acFormatPDF, strRecipient, , ,        strSubject, strMessageBody, False
  
  Finally:
  OlSecurityManager.DisableOOMWarnings = False
  
  
  End Sub
  </code></pre>