Using SendObject from Access 07 - need help with OL 07 warning

H

hlock

Using Office 2007 and exchange server...
Previously posted in Outlook VBA and in General Questions ...

I finally found a vb script that will email out my reports to individual
recipients. Works great! Now I'm encountering the dreaded warning message
about "A program is trying to automatically send email on your behalf". I've
looked at several solutions, but with my extremely limited knowledge of
scripting, I can't figure out how to incorporate the solutions in my Access
process. Here is the current code that I am using:

Function SendReportByEmail(strReportName As String, strEmail As String) As
Boolean
' Comments: Sends an email using SendObject method
' Parameters: strEmail - employee's email address
' strReportName - report name
' Returns: True of False

On Error GoTo PROC_ERR

Dim strRecipient As String
Dim strSubject As String
Dim strMessageBody As String

'set the mail varaibles
strRecipient = strEmail
strSubject = Reports(strReportName).Caption
strMessageBody = "Attached is a list of claims that have not been entered
into the Deductible Initiation Table. Please supply the deductible
information to ClaimHelp via a task. If the listed claim or claims do not
apply, please ignore this request."

'send the report as a snapshot
DoCmd.SendObject acSendReport, strReportName, acFormatTXT, strRecipient, , ,
strSubject, strMessageBody, False

SendReportByEmail = True

PROC_EXIT:
Exit Function

PROC_ERR:
SendReportByEmail = False
If Err.Number = 2501 Then
Call MsgBox( _
"The email was not sent for " & strEmail & ".", _
vbOKOnly + vbExclamation + vbDefaultButton1, _
"User Cancelled Operation")
Else
MsgBox Err.Description
End If
Resume PROC_EXIT

End Function

I've looked at Redemption, Wayne Phillips script and Outlookcode.com. **I
just can't figure out how to change my current script to get rid of the
warnings. ** If anyone has suggestions, please let me know. I may ask more
questions - so I appreciate patience.
 
C

Chris O'C via AccessMonster.com

It's an Outlook security feature. If the mailbox is on the Exchange server
it can be disabled by a setting on that server.

If the mailbox is on the user's pc you can use Click-Yes. It's free for
earlier versions of Outlook, but Outlook 2007 requires the pro version.

http://www.contextmagic.com/express-clickyes

Chris
Microsoft MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top