PC Review


Reply
Thread Tools Rate Thread

CDO send mail problem

 
 
Piotr
Guest
Posts: n/a
 
      16th Dec 2005
Hi I have strange problem, I have been using CDO VBA script from Ron de
Bruin site successfull for a long time. Now im trying to use it on the
other computer and I have strange problem:

On line: iConf.Load -1 ' CDO Source Defaults im reciving following
error: Object variable or With block not set.
????????????

regards
Peter

Sub Mail_Small_Text_CDO()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
' Dim Flds As Variant



Set iMsg = CreateObject("CDO.Message")
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") =
"Fill in your SMTP server here"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Update
End With



strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"



With iMsg
Set .Configuration = iConf
.To = "(E-Mail Removed)"
.CC = ""
.BCC = ""
.From = """Ron"" <(E-Mail Removed)>"
.Subject = "Important message"
.TextBody = strbody
.Send
End With



Set iMsg = Nothing
Set iConf = Nothing
End Sub

 
Reply With Quote
 
 
 
 
Ruskin Hardie
Guest
Posts: n/a
 
      19th Dec 2005
You are using this on another computer, which implies, that CDO is not
installed...

The error, is because you are trying to call a property or method of the
CDO.Configuration object, but that object is not set. After the line;
Set iConf = CreateObject("CDO.Configuration")
You may want to put a message, saying something like;
If iConf Is Nothing Then MsgBox "OH DEAR!!!"

That will confirm if the object can be created. Another thing you could
check, is open up your registry and check the HKEY_CLASS_ROOT section, to
see if there is CDO.Message and CDO.Configuration key in there (there will
be heaps of entries, but it's all in alphabetical order).




"Piotr" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi I have strange problem, I have been using CDO VBA script from Ron de
> Bruin site successfull for a long time. Now im trying to use it on the
> other computer and I have strange problem:
>
> On line: iConf.Load -1 ' CDO Source Defaults im reciving following
> error: Object variable or With block not set.
> ????????????
>
> regards
> Peter
>
> Sub Mail_Small_Text_CDO()
> Dim iMsg As Object
> Dim iConf As Object
> Dim strbody As String
> ' Dim Flds As Variant
>
>
>
> Set iMsg = CreateObject("CDO.Message")
> 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") =
> "Fill in your SMTP server here"
>
> .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
> = 25
> .Update
> End With
>
>
>
> strbody = "Hi there" & vbNewLine & vbNewLine & _
> "This is line 1" & vbNewLine & _
> "This is line 2" & vbNewLine & _
> "This is line 3" & vbNewLine & _
> "This is line 4"
>
>
>
> With iMsg
> Set .Configuration = iConf
> .To = "(E-Mail Removed)"
> .CC = ""
> .BCC = ""
> .From = """Ron"" <(E-Mail Removed)>"
> .Subject = "Important message"
> .TextBody = strbody
> .Send
> End With
>
>
>
> Set iMsg = Nothing
> Set iConf = Nothing
> End Sub
>



 
Reply With Quote
 
Piotr
Guest
Posts: n/a
 
      19th Dec 2005
I have found CDO.dll fles in Windows folder, I have also checked
HKEY_CLASS_ROOT I have found there CDO.Message and CDO.Configuration ?
So its look like It is installed...

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      19th Dec 2005
Hi

Note: the examples on my site use CDO for windows 2000
See the MSDN site for more information

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Piotr" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>I have found CDO.dll fles in Windows folder, I have also checked
> HKEY_CLASS_ROOT I have found there CDO.Message and CDO.Configuration ?
> So its look like It is installed...
>



 
Reply With Quote
 
Piotr
Guest
Posts: n/a
 
      21st Dec 2005
I got the answer !
Ron your code works fine on my XP but my bloody Kaspersky Antivirus was
keep on blocking macro from executing.

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      21st Dec 2005
Hi Piotr

Thanks for the feedback



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Piotr" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>I got the answer !
> Ron your code works fine on my XP but my bloody Kaspersky Antivirus was
> keep on blocking macro from executing.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with .send from microsoft example for vba send mail from excel code Mark Stephens Microsoft Excel Programming 4 3rd Feb 2010 12:27 PM
Mail Send & Rec Problem DianneS Windows Vista Mail 5 23rd Feb 2009 06:11 PM
Send Mail Problem Max Microsoft ASP .NET 1 1st Sep 2006 03:18 PM
Mail send problem Barry Microsoft ASP .NET 1 31st Aug 2006 03:27 PM
mailmerge problem - Mail are not send to mail client Fabien Microsoft Word Document Management 0 25th May 2006 10:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 PM.