LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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



 
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 07:38 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"