Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sending e-mail using CDO
I used Ron de Bruin's code from his site http://www.rondebruin.nl/cdo.htm
However, when I run it I get this error The "SendUsing" configuration value is invalid. Am I missing a reference maybe? Below is the code. Sub submitclick() Dim iMsg As Object Dim iConf As Object Dim wb As Workbook Dim WBname As String ' Dim Flds As Variant Application.ScreenUpdating = False Set wb = ActiveWorkbook ' It will save a copy of the file in C:/ with a Date and Time stamp WBname = wb.Name & " " & Format(Now, "dd-mm-yy h-mm-ss") & ".xls" wb.SaveCopyAs "C:/" & WBname Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") ' iConf.Load -1 ' CDO Source Defaults ' Set Flds = iConf.Fields ' With Flds ' ..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' ..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here" ' ..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ' .Update ' End With With iMsg Set .Configuration = iConf .To = " ' .CC = "" ' .BCC = "" ' .From = """"" " .Subject = "Out of Office Request" ' .TextBody = "This is the body text" .AddAttachment "C:/" & WBname .Send End With 'If you not want to delete the file you send delete this line Kill "C:/" & WBname Set iMsg = Nothing Set iConf = Nothing Set wb = Nothing Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sending Mail using VBA | Excel Programming | |||
General mail failure when sending e-mail from Excel | Excel Discussion (Misc queries) | |||
Sending E-mail | Excel Programming | |||
Sending E-mail | Excel Worksheet Functions |