Solved

VBA Send email but do not save in sent items

Posted on 2008-10-21
3
1,371 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
Comment Utility
Try before using .Send

setting
.DeleteAfterSubmit = True;

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

Author Comment

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

  .DeleteAfterSubmit = True
0
 

Author Comment

by:garygreen
Comment Utility
Will give you the points rnevet as you got there before me!

Cheers
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Outlook Free & Paid Tools
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now