ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   a program is trying to automatically send e-mail (https://www.excelbanter.com/excel-programming/295469-program-trying-automatically-send-e-mail.html)

ARN

a program is trying to automatically send e-mail
 
Can any one help in following.
I've an excel file which send email automatically,when i
press a command button( a macro assigned to it). It was
working perfectly in Office 2000, when i moved to office
XP it started showing the following message
"a program is trying to automatically send e-mail on your
behalf". How can avoid this message. I want to send the
mail without asking this question.

HERE IS THE CODE THAT I AM USING
================================
' Sub mail_with_outlook()

Dim Outapp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String

Dim strsub As String
Set Outapp = CreateObject("Outlook.application")
Set OutMail = Outapp.CreateItem(olMailItem)
strto = "
strsub = Sheets("Sheet1").Range("A1").Value
With OutMail
.To = strto
.Body = strsub
.ReadReceiptRequested = True
On Error Resume Next
.Send
Sheets("Sheet1").Range("A1").Value = ""
End With

End Sub


Bob Phillips[_6_]

a program is trying to automatically send e-mail
 
Take a look her http://www.rondebruin.nl/sendmail.htm#Prevent

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ARN" wrote in message
...
Can any one help in following.
I've an excel file which send email automatically,when i
press a command button( a macro assigned to it). It was
working perfectly in Office 2000, when i moved to office
XP it started showing the following message
"a program is trying to automatically send e-mail on your
behalf". How can avoid this message. I want to send the
mail without asking this question.

HERE IS THE CODE THAT I AM USING
================================
' Sub mail_with_outlook()

Dim Outapp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String

Dim strsub As String
Set Outapp = CreateObject("Outlook.application")
Set OutMail = Outapp.CreateItem(olMailItem)
strto = "
strsub = Sheets("Sheet1").Range("A1").Value
With OutMail
.To = strto
.Body = strsub
.ReadReceiptRequested = True
On Error Resume Next
.Send
Sheets("Sheet1").Range("A1").Value = ""
End With

End Sub





All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com