ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Annoying "virus" alert when using code to send mail (https://www.excelbanter.com/excel-programming/280783-annoying-virus-alert-when-using-code-send-mail.html)

steve

Annoying "virus" alert when using code to send mail
 
I am getting an alert when using the below code to send mail from Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose "No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb



Ron de Bruin

Annoying "virus" alert when using code to send mail
 
Check out this Steve
http://www.rondebruin.nl/sendmail.htm#Prevent

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message ...
I am getting an alert when using the below code to send mail from Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose "No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb





steve

Annoying "virus" alert when using code to send mail
 
Ron,

Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!

Your code specifies that the user must be connected to the internet. My
users are salesmen (on laptops) and they may or may not have internet
fired up. (I'll have to check this out to make sure.)

Tried the code in 97 & 2k and got an error on ".send"
(was on line) (Windows 2k)
Run Time Erro '-2147220960 (80040220)':
The "SendUsing" configuration value is invalid.

Both versions do not recognize "send".

Any suggestions?

Sub CDO_Send_Workbook()
' This sub use late binding, you don't have to set a reference' It is not
working in Windows 98 and ME.' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim WB As Workbook
Dim WBname As String Application.ScreenUpdating = False
Set WB = ActiveWorkbook
'If you want to mail the workbook where the code is placed you must use
'Set WB = ThisWorkbook WBname = WB.Name & " " & Format(Now,
"dd-mm-yy h-mm-ss") & ".xls" WB.SaveCopyAs "C:/" & WBname
' It will save a copy of the file in C:/ with a Date and Time stamp
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.To = "
.From = """Ron"" "
.Subject = "This is a test"
.TextBody = "Hi there"
.AddAttachment "C:/" & WBname
'.AddAttachment "C:/Test.txt"
' You can add any file you want with .AddAttachment "C:/Test.txt"
.Send

End With
Kill "C:/" & WBname 'If you not want to delete the file you send delete
this line
Set iMsg = Nothing
Set iConf = Nothing
Set WB = Nothing
Application.ScreenUpdating = True
End Sub
--
sb
"Ron de Bruin" wrote in message
...
Check out this Steve
http://www.rondebruin.nl/sendmail.htm#Prevent

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message

...
I am getting an alert when using the below code to send mail from Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose "No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email

Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb







Ron de Bruin

Annoying "virus" alert when using code to send mail
 
Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!


Read good this you can only do in Outlook Express
See the links for Outlook

Outlook

Outlook Redemption
http://www.dimastr.com/redemption/

Express ClickYes
http://www.express-soft.com/mailmate/clickyes.html

If you want to use CDO see the problem section for a macro to fill in the Smtp server in the code


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message ...
Ron,

Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!

Your code specifies that the user must be connected to the internet. My
users are salesmen (on laptops) and they may or may not have internet
fired up. (I'll have to check this out to make sure.)

Tried the code in 97 & 2k and got an error on ".send"
(was on line) (Windows 2k)
Run Time Erro '-2147220960 (80040220)':
The "SendUsing" configuration value is invalid.

Both versions do not recognize "send".

Any suggestions?

Sub CDO_Send_Workbook()
' This sub use late binding, you don't have to set a reference' It is not
working in Windows 98 and ME.' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim WB As Workbook
Dim WBname As String Application.ScreenUpdating = False
Set WB = ActiveWorkbook
'If you want to mail the workbook where the code is placed you must use
'Set WB = ThisWorkbook WBname = WB.Name & " " & Format(Now,
"dd-mm-yy h-mm-ss") & ".xls" WB.SaveCopyAs "C:/" & WBname
' It will save a copy of the file in C:/ with a Date and Time stamp
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.To = "
.From = """Ron"" "
.Subject = "This is a test"
.TextBody = "Hi there"
.AddAttachment "C:/" & WBname
'.AddAttachment "C:/Test.txt"
' You can add any file you want with .AddAttachment "C:/Test.txt"
.Send

End With
Kill "C:/" & WBname 'If you not want to delete the file you send delete
this line
Set iMsg = Nothing
Set iConf = Nothing
Set WB = Nothing
Application.ScreenUpdating = True
End Sub
--
sb
"Ron de Bruin" wrote in message
...
Check out this Steve
http://www.rondebruin.nl/sendmail.htm#Prevent

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message

...
I am getting an alert when using the below code to send mail from Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose "No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email

Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb









steve

Annoying "virus" alert when using code to send mail
 
Ron,

Thanks, again! But now the problem is having my users download and
install something - that won't work (unfortunately).

Guess I'll just have them click the "Yes" button...

--
sb
"Ron de Bruin" wrote in message
...
Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!


Read good this you can only do in Outlook Express
See the links for Outlook

Outlook

Outlook Redemption
http://www.dimastr.com/redemption/

Express ClickYes
http://www.express-soft.com/mailmate/clickyes.html

If you want to use CDO see the problem section for a macro to fill in the

Smtp server in the code


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message

...
Ron,

Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!

Your code specifies that the user must be connected to the internet. My
users are salesmen (on laptops) and they may or may not have internet
fired up. (I'll have to check this out to make sure.)

Tried the code in 97 & 2k and got an error on ".send"
(was on line) (Windows 2k)
Run Time Erro '-2147220960 (80040220)':
The "SendUsing" configuration value is invalid.

Both versions do not recognize "send".

Any suggestions?

Sub CDO_Send_Workbook()
' This sub use late binding, you don't have to set a reference' It is

not
working in Windows 98 and ME.' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim WB As Workbook
Dim WBname As String Application.ScreenUpdating = False
Set WB = ActiveWorkbook
'If you want to mail the workbook where the code is placed you must

use
'Set WB = ThisWorkbook WBname = WB.Name & " " & Format(Now,
"dd-mm-yy h-mm-ss") & ".xls" WB.SaveCopyAs "C:/" & WBname
' It will save a copy of the file in C:/ with a Date and Time stamp
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.To = "
.From = """Ron"" "
.Subject = "This is a test"
.TextBody = "Hi there"
.AddAttachment "C:/" & WBname
'.AddAttachment "C:/Test.txt"
' You can add any file you want with .AddAttachment

"C:/Test.txt"
.Send

End With
Kill "C:/" & WBname 'If you not want to delete the file you send

delete
this line
Set iMsg = Nothing
Set iConf = Nothing
Set WB = Nothing
Application.ScreenUpdating = True
End Sub
--
sb
"Ron de Bruin" wrote in message
...
Check out this Steve
http://www.rondebruin.nl/sendmail.htm#Prevent

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message

...
I am getting an alert when using the below code to send mail from

Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose

"No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email

Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ", _
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb











Michael D. Ober

Annoying "virus" alert when using code to send mail
 
Outlook Express is part of Internet Explorer. If they have IE 5.0 or later,
then they already have a relatively current (and stable) version of Outlook
Express.

Mike.

"steve" wrote in message
...
Ron,

Thanks, again! But now the problem is having my users download and
install something - that won't work (unfortunately).

Guess I'll just have them click the "Yes" button...

--
sb
"Ron de Bruin" wrote in message
...
Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!


Read good this you can only do in Outlook Express
See the links for Outlook

Outlook

Outlook Redemption
http://www.dimastr.com/redemption/

Express ClickYes
http://www.express-soft.com/mailmate/clickyes.html

If you want to use CDO see the problem section for a macro to fill in

the
Smtp server in the code


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message

...
Ron,

Thank you for your prompt response! You confirmed my worst fear -
having to disable the function in Outlook. Don't want to do that!

Your code specifies that the user must be connected to the internet.

My
users are salesmen (on laptops) and they may or may not have internet
fired up. (I'll have to check this out to make sure.)

Tried the code in 97 & 2k and got an error on ".send"
(was on line) (Windows 2k)
Run Time Erro '-2147220960 (80040220)':
The "SendUsing" configuration value is invalid.

Both versions do not recognize "send".

Any suggestions?

Sub CDO_Send_Workbook()
' This sub use late binding, you don't have to set a reference' It is

not
working in Windows 98 and ME.' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim WB As Workbook
Dim WBname As String Application.ScreenUpdating = False
Set WB = ActiveWorkbook
'If you want to mail the workbook where the code is placed you

must
use
'Set WB = ThisWorkbook WBname = WB.Name & " " & Format(Now,
"dd-mm-yy h-mm-ss") & ".xls" WB.SaveCopyAs "C:/" & WBname
' It will save a copy of the file in C:/ with a Date and Time

stamp
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.To = "
.From = """Ron"" "
.Subject = "This is a test"
.TextBody = "Hi there"
.AddAttachment "C:/" & WBname
'.AddAttachment "C:/Test.txt"
' You can add any file you want with .AddAttachment

"C:/Test.txt"
.Send
End With
Kill "C:/" & WBname 'If you not want to delete the file you send

delete
this line
Set iMsg = Nothing
Set iConf = Nothing
Set WB = Nothing
Application.ScreenUpdating = True
End Sub
--
sb
"Ron de Bruin" wrote in message
...
Check out this Steve
http://www.rondebruin.nl/sendmail.htm#Prevent

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"steve" wrote in message
...
I am getting an alert when using the below code to send mail from

Excel.
How do I prevent this alert?

Thanks for your help...

The alert reads:
A program is trying to automatically send e-mail on your

behalf.
Do you want to Allow this.
If this is unexpected, it may be a virus and you should choose

"No".

Sub SendMyMail()
Dim subj As String
Application.DisplayAlerts = False

If MsgBox("Ready to send?", vbYesNo + vbQuestion) = vbYes Then
subj = Sheets(2).Cells(7, 3) & " Quote "
subj = subj & InputBox("Add to your Subject Line", "email
Subject")
subj = WorksheetFunction.Proper(subj)

'Emails the activeworkbook'
ActiveWorkbook.SendMail ",

_
Subject:=subj, ReturnReceipt:=True
End If

Application.DisplayAlerts = True
End Sub


--
sb














All times are GMT +1. The time now is 04:18 PM.

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