View Single Post
  #1   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

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