View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Send web mail from Excel (VBA)??

Max,
At a guess, it looks like you have a extra leading space in "
CDO.Configuration".

NickHK

"MaxS" wrote in message
oups.com...
Hi Ron,

your site helped and I could send the message via my gmail account.
However when I run the same code from work i get the following message:

"ActiveX component can't create object" on the line of code
"Set iConf = CreateObject(" CDO.Configuration")"

I have Win XP and Office 2002 at home and in the office. So the systems
are the same.

Any ideas why this can happen?

Here goes my code:

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/smtpauthenticate
") = 1

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.gmail.com "

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 465
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") =
"
.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "my
pass"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl ") =
True
.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 = "
.CC = ""
.BCC = ""
.From = """MasS"" < "
.Subject = "Important message"
.TextBody = strbody
.Send
End With



Set iMsg = Nothing
Set iConf = Nothing
End Sub












Ron de Bruin wrote:

Hi MaxS

Try CDO
http://www.rondebruin.nl/cdo.htm

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



"MaxS" wrote in message

oups.com...
Hi,

is it possible to do the following in VBA:

I run a lenthy simulation on another computer and would like the
program to send me an emai when it is finished.

If I do this using MS Outlook i get a security warning which asks to
press "OK". So not much automation after all.
Can I send an email automatically using a web email account like gmail
or hotmail?


Thanks a lot?