View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 153
Default Sending Email using CDO ERROR

You need to be on W2000 and you need valid email
addresses and an smtp which recognises your email. It
does work


-----Original Message-----
http://www.rondebruin.nl/cdo.htm#sheet

I went to the above site and tried various codes. I

kept
getting the same error on each code I tried to use. see
error below....

"Run-Time error '-2147024770(8007007e)':
Automation error
The specified module could not be found."

When I click debug, the following part of the code is
highlighted.

" Set iMsg = CreateObject("CDO.Message")"

Here is the entire code below.

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(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")
With iMsg
Set .Configuration = iConf
.To = "
.From = """Ron"" "
.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


Any ideas?

Thanx
Todd
.