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