Outlook - Object Model Guardian

  • Thread starter Braindeadbeachbum
  • Start date
B

Braindeadbeachbum

Hi Guys

I'm running Office 2003 and need to automate the sending of a notification
e-mail to myself when ever my code receives and error. I used the following
code but this screen keeps popping up saying: A program is trying to
automatically send e-mail on your behalf. Do you want to allow this?...

I think it's the "Outlook - Object Model Guardian" requesting this
confirmation.

Is there any work around as this e-mail needs to go out without any human
interaction?

Private Sub SendErrorEmail()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Dim strMessage As String

Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)

strMessage = "Jan," & Chr(13) & Chr(13)
strMessage = strMessage & "This is just a test." & Chr(13) & Chr(13)
strMessage = strMessage & "Cheers. Jan"

With objMail
.To = "(e-mail address removed)"
.Subject = "Testing"
.Body = strMessage
.Display
.Send
End With

Set objMail = Nothing
Set objOutlook = Nothing

End Sub

Please help!!
 
R

Rob Bovey

B

Braindeadbeachbum

Hi Rob

I installed Redemption but had some hassels getting it to work and got
frustrated. I thought maybe there's an easier way of doing this like a
setting within Outlook or disabling an Outlook function... Back to Redemption
I guess.

Thanks
 
G

Gary Dyrkacz

Hi Guys

I'm running Office 2003 and need to automate the sending of a notification
e-mail to myself when ever my code receives and error. I used the following
code but this screen keeps popping up saying: A program is trying to
automatically send e-mail on your behalf. Do you want to allow this?...

I think it's the "Outlook - Object Model Guardian" requesting this
confirmation.

Is there any work around as this e-mail needs to go out without any human
interaction?

Private Sub SendErrorEmail()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Dim strMessage As String

Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)

strMessage = "Jan," & Chr(13) & Chr(13)
strMessage = strMessage & "This is just a test." & Chr(13) & Chr(13)
strMessage = strMessage & "Cheers. Jan"

With objMail
.To = "(e-mail address removed)"
.Subject = "Testing"
.Body = strMessage
.Display
.Send
End With

Set objMail = Nothing
Set objOutlook = Nothing

End Sub

Please help!!

Also do a search for Express ClickYes. I have been using this for a
awhile with good results.
Gary Dyrkacz
(e-mail address removed)
Radio Control Aircraft/Paintball Physics/Paintball for 40+
http://home.comcast.net/~dyrgcmn/
 

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