Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run-time error 2147220960(80040220) mail with outlook
I have problems too. I can't reference Microsoft CDO Windows 2000 component, because there is just Microsoft CDO For Exchange 2000 Library. My computer is in a network, where there is one common Exchange Server 2003 (I don't have it in my computer installed, but I have an account in it). So is there any changes I have to make to the code, becouse when I use given code, the error is displayed - "object in not registered". I suppose it is CDO.Message
"jstrater" rakstîja: I'm having the same problem, although in a different environment (late-binding VBA in Excel '97 with Netscape Messenger 4.73 as the default email client - yes it's a crappy setup, that's why I'm trying something neutral like CDO). It seems that no matter how I set the "senduser" field I get this same error. I've tried setting a reasonable value for every other field and I still get the error. Anyone have a clue about this? Thanks, James |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run-time error 2147220960(80040220) mail with outlook
I have problems to send message from Microsoft Excel 2003, Microsoft Windows 2000 OS.
I use the code with CDO method to send mail without using any e-mail program (Microsoft Outlook 2003, Outlook Express). This is the function I use. Sub Message() ' This example use late binding, you don't have to set a reference ' You must be online when you run the sub Dim iMsg As Object Dim iConf As Object Dim cell As Range Dim Flds As Variant Application.ScreenUpdating = False 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") = "my exchange server name" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Update End With 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") 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 End If End If Next cell Set iConf = Nothing Application.ScreenUpdating = True End Sub I get error message like this Run-time error '-2147221164(80040154)': Class not registered Yellow mark is on ".Send" (after .TextBody and before End With) When I add reference, I add the following COM's Microsoft CDO for Exchange 2000 Library Microsoft CDO for NTS 1.2 Library and default references I don't have any "Microsoft CDO windows 2000 Library" COM (maybe I have to change something in code). If someone knows about my problem, please write back. "jstrater" rakstîja: I'm having the same problem, although in a different environment (late-binding VBA in Excel '97 with Netscape Messenger 4.73 as the default email client - yes it's a crappy setup, that's why I'm trying something neutral like CDO). It seems that no matter how I set the "senduser" field I get this same error. I've tried setting a reasonable value for every other field and I still get the error. Anyone have a clue about this? Thanks, James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail merge, Outlook | Excel Discussion (Misc queries) | |||
E-Mail attachment to same e-mail address in Outlook | Excel Discussion (Misc queries) | |||
e-mail from excel when outlook is not in use | Excel Discussion (Misc queries) | |||
Error: cannot load the mail service. Check your mail installation. | Excel Discussion (Misc queries) | |||
sending outlook mail | Excel Programming |