?
Solved

VBA Send email but do not save in sent items

Posted on 2008-10-21
3
Medium Priority
?
1,934 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
rnevet earned 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
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 …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

777 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