PDA

View Full Version : email + no pop up warning message?



next
10-12-2010, 02:35 PM
I have a script to send out emails through excel to people and so far I have several issues:
1) If I try to automatically send without displaying the message itself, I get a warning asking me to confirm that I actually want to do this. How do I remove this?
2) Sending email without displaying it first interprets CSS that I use to style the message as text, rather than code. This happens only if I send the message WITHOUT displaying it first. Is this a bug?

Here's a basic example of my code:
Sub Macro3()
Dim Outlook As Object, NewMail As Object

Set Outlook = CreateObject("Outlook.Application")
Set NewMail = Outlook.CreateItem(olMailItem)

With NewMail
.To = "xxx@xxx.com"
.subject = "my subject"
.BodyFormat = olFormatHTML
.HTMLBody = "message"
.Display
'.send
End With
End Sub

Kenneth Hobs
10-12-2010, 04:09 PM
Try using cdo instead. http://www.vbaexpress.com/forum/showthread.php?t=22439

Jan Karel Pieterse
10-12-2010, 11:01 PM
Should you be locked out of CDO, there is a product called Outlook Redemption which avoids the warning. It must be installed on all systems that use the code however. http://www.dimastr.com/redemption/

next
10-13-2010, 11:28 AM
This is perfect, thank you.

next
10-13-2010, 01:28 PM
Hmm, I get compile error: "expected: =".
here's how I use it:
CDOMail_SendMessage (SendTo:=crew.Email, SendCC:="", SendBCC:="", _
From:="Accounting", ReplyTo:="DoNotReply@cleanway.com", _
Subject:="Subject", BodyHTML:="body", BodyPlain:="")
Does anyone know why?

Jan Karel Pieterse
10-13-2010, 11:04 PM
Remove the () brackets