Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDO emailing
hi
I'm using a typical code that sends email using CDO objects. The code has an ".addattachment" method to attach file. This code is basically in a loop that sends 1 email after another by getting email addresses from a range of cells. The objective is to send one attachment per email. The problem is the .addattachment method keeps stacking up files from previous attachments as the code loops. The first email would get its attachment; 2nd email would get its attachment plus that of the first email, and so on. How can I clear out this .addattachment method before the next loop ? Thanks Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CDO emailing
Me again...
I managed to track down the DeleteAll method from MS site (http://msdn.microsoft.com/library/de...66dcac6a8a.asp) For my case, to avoid adding more and more attachments to the attachments collection as a result of a loop, the attachments collection can be cleared as followed. do while... ... objMsg.addattachment "c:\test.zip" objMsg.send objMsg.attachements.DeleteAll ' This method empties out the Attachments collection. ' It can be at either the beginning or the end of a loop. ... loop Steve "SP" wrote in message ... hi I'm using a typical code that sends email using CDO objects. The code has an ".addattachment" method to attach file. This code is basically in a loop that sends 1 email after another by getting email addresses from a range of cells. The objective is to send one attachment per email. The problem is the .addattachment method keeps stacking up files from previous attachments as the code loops. The first email would get its attachment; 2nd email would get its attachment plus that of the first email, and so on. How can I clear out this .addattachment method before the next loop ? Thanks Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Emailing | Excel Discussion (Misc queries) | |||
emailing pdf | Excel Discussion (Misc queries) | |||
emailing | Excel Worksheet Functions | |||
emailing | Excel Programming | |||
Emailing in VBA | Excel Programming |