LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default array for email attachments?


I have a column of email adresses(B) and a column of files(C) which need
to be attached in the emails. The spreadsheet shows that files in both
C1 and C2 need to go to -- but the script will not send the
email in the second row w/o an email address in there. This doesn't
seem like a problem, but some addresses have about 20 files and I dont
want to send them 20 separate emails... I'm guessing I need to setup an
array to facilitate the various numbers of attachements but I'm new at
this and don't know how!

Any help is appreciated,

MY SPREADSHEET:

Code:
--------------------

A1: B1:
C1: C:/file1.exe
A2: B2: C2: C:/file2.exe
A2: B3:
C3: C:/file3.exe

--------------------


THE CODE (PARTIAL):

Code:
--------------------
Set varOutApp = CreateObject("Outlook.Application")
Set varSendIt = varOutApp.CreateItem(0)

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")

For Each cell In Sheets("Sheet1").Columns("B").Cells.SpecialCells(x lCellTypeConstants)
If cell.Offset(0, 1).Value < "" Then
If cell.Value < "" And Dir(cell.Offset(0, 1).Value) < "" Then
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = cell.Value
.Subject = "Testfile"
.Body = "Hi "
.Attachments.Add cell.Offset(0, 1).Value
.Send 'Or use Display
End With
Set OutMail = Nothing
End If
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True

End Sub
--------------------


--
joox
------------------------------------------------------------------------
joox's Profile:
http://www.excelforum.com/member.php...o&userid=23711
View this thread: http://www.excelforum.com/showthread...hreadid=373880

 
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
Email With attachments Twisty1980 Excel Discussion (Misc queries) 1 May 19th 08 05:18 PM
Cannot open .xls attachments from email Meredith Setting up and Configuration of Excel 4 January 4th 08 07:58 AM
email with attachments from list kristin Excel Discussion (Misc queries) 1 September 28th 07 07:01 PM
Email attachments Holden Caulfield New Users to Excel 1 April 20th 07 02:00 AM
Send an email, some with/without attachments [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 08:34 PM


All times are GMT +1. The time now is 08:16 AM.

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

About Us

"It's about Microsoft Excel"