View Single Post
  #25   Report Post  
Posted to microsoft.public.excel.misc
milos milos is offline
external usenet poster
 
Posts: 12
Default E-mail to every e-mail address in an Excel column?

Hi there, I'm using your code you posted here. And it works when tha data in
column C are plain e-mail adresses. But problem is that my adresses in column
C are "=concatenate(A1;B1)", so they are result of a formula. What should I
change in the code to make it work? I'm not very familiar with VBA.
Thanks.
Milos


Ron de Bruin pÃ*Å¡e:

Hi

Try this one with the e-mail addresses in "Sheet1" column C
Visit also my site for more examples

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

For Each cell In ThisWorkbook.Sheets("Sheet1") _
.Columns("C").Cells.SpecialCells(xlCellTypeConstan ts)
If cell.Value Like "*@*" Then
strto = strto & cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = strto
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ("C:\test.doc")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

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



"MrMan&Fam" wrote in message ...
Say I have an Excel spreadsheet with one column of e-mail addresses. I want
to send the same piece of e-mail (a WORD file) to each address. Is there an
easy way?