Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2319
  • Last Modified:

VBA Send email but do not save in sent items

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
garygreen
Asked:
garygreen
  • 2
1 Solution
 
rnevetCommented:
Try before using .Send

setting
.DeleteAfterSubmit = True;

http://msdn.microsoft.com/en-us/library/aa211833(office.11).aspx
0
 
garygreenAuthor Commented:
Found the answer myself, thanks for everyone who looked at this anyway

  .DeleteAfterSubmit = True
0
 
garygreenAuthor Commented:
Will give you the points rnevet as you got there before me!

Cheers
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now