Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How can I send file by different email address (to; cc and bcc)

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(xlCellTypeConst ants)

'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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default How can I send file by different email address (to; cc and bcc)

Try this.....

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

--

Regards,
Nigel




wrote in message
...
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(xlCellTypeConst ants)

'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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to send email to address within selection in Excel workbook vic1 Excel Discussion (Misc queries) 3 May 28th 08 09:51 PM
Send data from Excel in email from specific email address Erik Excel Programming 5 December 5th 07 05:09 PM
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
How prevent email address from being hotlinked to open send msg wi John Excel Worksheet Functions 1 January 14th 06 10:36 PM
Loop through email address list to send e-mails Paul. Excel Discussion (Misc queries) 1 April 12th 05 12:41 PM


All times are GMT +1. The time now is 01:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"