Solved

VBA Send email but do not save in sent items

Posted on 2008-10-21
3
1,545 Views
Last Modified: 2012-05-05
Hello all,

I have an app which emails XLS files to a client.  This works fine but we send about 150-200 200k files every day so my Sent Items folder quickly fills up with 30MB of files or so every day.  I do not need these files once they have been sent so my question is:

How can I continue to send the files but for Outlook to not save the message in Sent Items.  I have a search folder configured to identify these emails so I just periodically empty this folder.  My code is attached below, hopefully someone can tell me a simple command to force Outlook to just send the email without saving it

Set olapp = CreateObject("Outlook.Application")
Set oItem = olapp.CreateItem(0)
With oItem
      .Subject = "Purchase Order: PO" & Trim(Str(numb + 1))
      .To = emailaddress
      .Attachments.Add "C:\PO " & Trim(Str(numb + 1)) & ".xls"
      .Send
End With

Set olapp = Nothing
Set oItem = Nothing

I am away until next Monday so if I don't respond until then thanks for your responses.

Cheers

Gary
0
Comment
Question by:garygreen
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
rnevet earned 50 total points
ID: 22767421
Try before using .Send

setting
.DeleteAfterSubmit = True;

http://msdn.microsoft.com/en-us/library/aa211833(office.11).aspx
0
 

Author Comment

by:garygreen
ID: 22767455
Found the answer myself, thanks for everyone who looked at this anyway

  .DeleteAfterSubmit = True
0
 

Author Comment

by:garygreen
ID: 22767460
Will give you the points rnevet as you got there before me!

Cheers
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question