View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Appache Appache is offline
external usenet poster
 
Posts: 11
Default Send multiple email in Excel

I assign the macro to a button but it gives an error which is "Cant execute
code in break mode" on the line of Set OutApp =
CreateObject("Outlook.Application")

I dont know what the break mode is? Do you have any idea what is that?

--
Thanks


"Ron de Bruin" wrote:

Hi Appache

You can do it with a macro if you want

Sub Mail_small_Text_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim cell As Range
Dim strto As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

For Each cell In Selection
If cell.Value Like "*@*" Then
strto = strto & cell.Value & ";"
End If
Next
If Len(strto) 0 Then strto = Left(strto, Len(strto) - 1)

With OutMail
.To = strto
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = strbody
.display
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


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



"Appache" wrote in message ...
I have a column named e-mails in excel that e-mail addresses accommodate in
that column. What I want to do is to send an email to selected email
addresses via outlook. I want outlook to be opened and all the selected email
addresses are placed in the to: field in outlook. Is there any way to do that?

--
Thanks