PC Review


Reply
Thread Tools Rate Thread

How can I send file by different email address (to; cc and bcc)

 
 
beancurdjelly2003@yahoo.com.hk
Guest
Posts: n/a
 
      28th Jan 2008
I can send out with different attached workbook by different email
address (to, but if I need to send email with cc and bcc, how can I
do it?

column B = .To
column C = .cc
column D = .Bcc

Below is my marco, please help me. Thanks!

Sub Send_Files()
Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim cell As Range, FileCell As Range, rng As Range

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set sh = Sheets("SendFiles")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

For Each cell In
sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)

'Enter the file names in the E:Z column in each row
Set rng = sh.Cells(cell.Row, 1).Range("E1:Z1")

If cell.Value Like "?*@?*.?*" And _
Application.WorksheetFunction.CountA(rng) > 0 Then
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = cell.Value
.Cc = ""
.Bcc = ""
.Subject = cell.Offset(0, -1).Value & " SmarTone-
Vodafone Bill" & " - " & Format(Now, "mmmm yy")
.Body = "Dear Customer," & vbNewLine & vbNewLine & _
"Please contact us on or before " &
Format(Now, "mmmm")

For Each FileCell In
rng.SpecialCells(xlCellTypeConstants)
If Trim(FileCell) <> "" Then
If Dir(FileCell.Value) <> "" Then
.Attachments.Add FileCell.Value
End If
End If
Next FileCell

.Display 'Or use Send
End With

Set OutMail = Nothing
End If
Next cell

Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub



 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      28th Jan 2008
Try this.....

..To = cell.Value
..Cc = cell.offset(0,1).value
..Bcc = cell.offset(0,2).value

--

Regards,
Nigel
(E-Mail Removed)



<(E-Mail Removed)> wrote in message
news:77dfe6a9-f598-4d6b-90da-(E-Mail Removed)...
>I can send out with different attached workbook by different email
> address (to, but if I need to send email with cc and bcc, how can I
> do it?
>
> column B = .To
> column C = .cc
> column D = .Bcc
>
> Below is my marco, please help me. Thanks!
>
> Sub Send_Files()
> Dim OutApp As Object
> Dim OutMail As Object
> Dim sh As Worksheet
> Dim cell As Range, FileCell As Range, rng As Range
>
> With Application
> .EnableEvents = False
> .ScreenUpdating = False
> End With
>
> Set sh = Sheets("SendFiles")
>
> Set OutApp = CreateObject("Outlook.Application")
> OutApp.Session.Logon
>
> For Each cell In
> sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)
>
> 'Enter the file names in the E:Z column in each row
> Set rng = sh.Cells(cell.Row, 1).Range("E1:Z1")
>
> If cell.Value Like "?*@?*.?*" And _
> Application.WorksheetFunction.CountA(rng) > 0 Then
> Set OutMail = OutApp.CreateItem(0)
>
> With OutMail
> .To = cell.Value
> .Cc = ""
> .Bcc = ""
> .Subject = cell.Offset(0, -1).Value & " SmarTone-
> Vodafone Bill" & " - " & Format(Now, "mmmm yy")
> .Body = "Dear Customer," & vbNewLine & vbNewLine & _
> "Please contact us on or before " &
> Format(Now, "mmmm")
>
> For Each FileCell In
> rng.SpecialCells(xlCellTypeConstants)
> If Trim(FileCell) <> "" Then
> If Dir(FileCell.Value) <> "" Then
> .Attachments.Add FileCell.Value
> End If
> End If
> Next FileCell
>
> .Display 'Or use Send
> End With
>
> Set OutMail = Nothing
> End If
> Next cell
>
> Set OutApp = Nothing
> With Application
> .EnableEvents = True
> .ScreenUpdating = True
> End With
> End Sub
>
>
>


 
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
why my address book always automantic add the email address who send me Phili Zhang Windows Vista Mail 4 20th Feb 2009 09:23 PM
Send Email from Access changing email address in From to be different than sending address tomlebold@msn.com Microsoft Access 0 7th Dec 2006 08:44 PM
Set which local email account can send mail to contacts in address book. (associating an email address with a contact) Scott Streit Microsoft Outlook 3 27th Jan 2006 02:57 PM
Client Table with Email? Click email address to send email? =?Utf-8?B?QnJvb2s=?= Microsoft Access Forms 0 10th Aug 2005 05:06 PM
With Outlook 2K3 Is it possible to associate a reply-to account for any particular address book send-to email address ? Steve Microsoft Outlook 1 26th Apr 2005 02:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:54 AM.