H
hlock
Using Office 2007 and exchange server...
Previously posted in Outlook VBA...
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.
Previously posted in Outlook VBA...
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.