Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error 2147220960(80040220) mail with outlook

Hi

I actually spent a lot of time Ron de Bruin's web and internet before
posting
my message.

when I try to copy and paste Ron de Bruin code:


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(Date, "dd-mm-yy") _
& " " & Format(Time, "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 = "
.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

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 = """Ron"" "
.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


I get the error message:

Run-time error '2147220960(80040220)':
The "SendUsing" configuration is invalid.

Please tell me what I'm doing wrong. Thanks!
win xp, excel2002 ,microsoft outlook 2002



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Run-time error 2147220960(80040220) mail with outlook

Hi

See the problem section on my website
You must fill in the Smtp server also in the code
http://www.rondebruin.nl/cdo.htm#Problems

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



"jale" wrote in message ...
Hi

I actually spent a lot of time Ron de Bruin's web and internet before
posting
my message.

when I try to copy and paste Ron de Bruin code:


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(Date, "dd-mm-yy") _
& " " & Format(Time, "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 = "
.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

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 = """Ron"" "
.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


I get the error message:

Run-time error '2147220960(80040220)':
The "SendUsing" configuration is invalid.

Please tell me what I'm doing wrong. Thanks!
win xp, excel2002 ,microsoft outlook 2002





  #3   Report Post  
Posted to microsoft.public.excel.programming
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge, Outlook Luke Williams Excel Discussion (Misc queries) 0 February 19th 09 03:57 PM
E-Mail attachment to same e-mail address in Outlook Vick Excel Discussion (Misc queries) 4 May 17th 07 07:53 PM
e-mail from excel when outlook is not in use Jignesh Khandwala Excel Discussion (Misc queries) 5 April 7th 06 09:52 AM
Error: cannot load the mail service. Check your mail installation. Brad Bowser Excel Discussion (Misc queries) 0 December 20th 05 10:03 PM
sending outlook mail bilal Excel Programming 1 July 25th 03 01:16 PM


All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"