JBuckner wrote:
My macro uses the Send Object (VBA Item.Send) function to email a
spreadsheet to an Outlook contact list. I want the function to be completely
automatic but Outlook displays a security warning message (...another
program is attempting to automatically email...) that requires user
intervention before the macro will finish execution.
You may wish to use CDO. Here is a sample.
Public Sub VerySimpleSendM ailWithCDOSampl e()
Dim iCfg As Object
Dim iMsg As Object
Set iCfg = CreateObject("C DO.Configuratio n")
Set iMsg = CreateObject("C DO.Message")
With iCfg.Fields
..Item("http://schemas.microso ft.com/cdo/configuration/sendusing") = 2
..Item("http://schemas.microso ft.com/cdo/configuration/smtpserverport" )
= 25
..Item("http://schemas.microso ft.com/cdo/configuration/smtpserver") =
"smtp.aim.c om"
..Item("http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e")
= 1
..Item("http://schemas.microso ft.com/cdo/configuration/sendusername") =
"MyUserName "
..Item("http://schemas.microso ft.com/cdo/configuration/sendpassword") =
"MyPassord"
..Item("http://schemas.microso ft.com/cdo/configuration/sendemailaddres s")
= "Lyle Fairfield <ly***********@ aim.com>"
..Update
End With
With iMsg
..Configuration = iCfg
..Subject = "Temp.xls"
..To = "lf********@cog eco.ca"
..TextBody = "This is the latest!"
..AddAttachment "C:\Program Files\Backup Scripts\Temp.xl s"
..Send
End With
Set iMsg = Nothing
Set iCfg = Nothing
End Sub
I believe that you can link to your Outlook Contacts (File - Get
External Data - Link Tables) to get your addresses.