View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
jale jale is offline
external usenet poster
 
Posts: 2
Default Run-time error 2147220960(80040220) mail with outlook


Thanks for reply Ron

I am still not working situation.My code's are below:
again errors :

Run-time error '2147220960(80040220)':
The "SendUsing" configuration is invalid.
and
Run-time error '2147220973(80040213)':
Transport failed to the connect to the server


Note:my outgoing server setting:my outgoing server(SMTP) requires
authenticantion checked
and logon using username and password and remember password checked....


Sub Message()
' 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 cell As Range
Application.ScreenUpdating = False
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(x lCellTypeConstants)
If cell.Offset(0, 1).Value < "" Then
If cell.Value Like "*@*" And cell.Offset(0, 1).Value = "yes"
Then
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """ibo"" "
.Subject = "Reminder"
.TextBody = "Dear " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please contact us to discuss bringing your
account up to date"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End If
End If
Next cell
Application.ScreenUpdating = True
End Sub


Sub CDO_Send_Workbook_2_Early_Binding()
' This sub use Early Binding, you must set a reference
' to the Microsoft CDO for Windows 2000 Library (Exchange in Win Xp)
' It is not working in Windows 98 and ME.
' You must be online when you run the sub

Dim iMsg As CDO.Message
Dim iConf As CDO.Configuration
Dim Flds As Variant
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 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")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.mail.ttnet.net.tr"
.Item(cdoSMTPServerPort) = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "
.From = """ibo"" "
.Subject = "This is a test"
.TextBody = "Hi there"
.AddAttachment "C:/" & WBname
' You can add any file you want with
'.AddAttachment "C:/Test.txt"
.Send
End With

Kill "C:/" & WBname
Set iMsg = Nothing
Set iConf = Nothing
Set WB = Nothing
Application.ScreenUpdating = True
End Sub


Thanks for helping.