![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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\Freig ht Guidelines for Suppliers\Supplier Memo.pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht Guidelines for Suppliers\ Routing Guide (Rev 10).pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht 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 |
Ads |
#2
|
|||
|
|||
![]()
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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Junior728" wrote in message ... 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\Freig ht Guidelines for Suppliers\Supplier Memo.pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht Guidelines for Suppliers\ Routing Guide (Rev 10).pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht 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 |
#3
|
|||
|
|||
![]()
What is the exact error?
-- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Junior728" wrote in message ... 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\Freig ht Guidelines for Suppliers\Supplier Memo.pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht Guidelines for Suppliers\ Routing Guide (Rev 10).pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht 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 |
#4
|
|||
|
|||
![]()
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. "Dmitry Streblechenko" wrote: What is the exact error? -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Junior728" wrote in message ... 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\Freig ht Guidelines for Suppliers\Supplier Memo.pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht Guidelines for Suppliers\ Routing Guide (Rev 10).pdf") .Attachments.Add ("S:\SiteData\SIN2\EMS\Purchasing\Pur\JMatls\Freig ht 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook rules restrictions | Zadig Galbaras | Outlook - General Queries | 15 | May 8th 08 06:42 PM |
Working with SMTP Restrictions | TC | Outlook - General Queries | 1 | February 1st 07 11:04 PM |
Mailbox restrictions not working? | Chris Weber | Outlook - General Queries | 0 | May 2nd 06 08:24 PM |
Autoaccept restrictions by user | Boe | Outlook - Calandaring | 1 | April 25th 06 07:23 PM |
Browsing Restrictions | Cgriffin | Outlook Express | 1 | February 19th 06 12:20 AM |