Is there any restrictions to the number of Attachment i can add?

J

Junior728

Hi,

I am able to add the 3 attachment and automate it in vba. However, whenever,
i added the 4th attachment, it will produce error. See my script below:

Sub Freight()


Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)


With OutMail

Dim cell As Range
Dim strto As String
Dim strbody As String
Dim strbody1 As String

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
strbody = " Pls do not reply to this email. This is an automated email
generated to the intended parties.Thanks!"
strbody1 = " Pls disregard Rev 9B from the previous email sent and use
this Rev 10 effective date 29 June 09!"
For Each cell In ThisWorkbook.Sheets("EmailAdd").Range("A2",
Cells(LastRow, "A"))
If cell.Value Like "?*@?*.?*" Then
strto = strto & cell.Value & ";"
End If
Next cell
If Len(strto) > 0 Then strto = Left(strto, Len(strto) - 1)

.BCC = strto
.Subject = "Supplier Freight Arrangement Guidelines Rev 10 (Pls
disregard Rev 9B)"
.Body = strbody
.Body = strbody1
.Attachments.Add
("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freight Guidelines for
Suppliers\Supplier Memo.pdf")
.Attachments.Add
("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freight Guidelines for
Suppliers\ Routing Guide (Rev 10).pdf")
.Attachments.Add
("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freight Guidelines for
Suppliers\Worksheet in Routing Guide (Rev 10).pdf")
.Send 'or use '.Display
End With

Set OutMail = Nothing
Set OutApp = Nothing


Workbooks("Freight Macro.xls").Close SaveChanges:=True
Application.CommandBars("CreateOutlookMsg").Delete
End Sub


So i wish to know backend, is there any limitations of the no of attachment
to be added in an email send out by using vba. If using buttons, it should
not be a problem
 
K

Ken Slovak - [MVP - Outlook]

I think the most attachments I ever added with code to a mail item was about
500, I'm not sure what the maximum limit would be.
 
J

Junior728

Hi,

I think there is some other things that causes the error. I did not save
the error. But now i have retry again, and it works.

thanks for the advice anyway.
 
Top