Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook VBA and Computed Fields!

Status
Not open for further replies.

ppepin

IS-IT--Management
Mar 13, 2001
36
0
0
US
Ok, I've got a stupid question for something I am trying to do and can't figure out.

Here is my situation:

I have an Outlook Personal Folder containing over 10,000 emails. These emails are sent to me every day (nightly batch run status) and there is a server rule to move these message from my Inbox to a folder.

What I need to do is delete all of the messages in this folder for every day except Friday. I am able to create a new formula field that I can calculate the day of the week based upon the date, and display it as a field in the folder.

Here is my problem. Once I create this field, I cannot sort on it because it is a formula!!!!!!!!

I figured that this would be the easiest way to delete all the messages if I can sort on the Day, then just SHIFT-click an entire block of messages to delete.

Is there anyone out there who can give me and idea of how to accomplish this?

Thanks.







 
I'm kinda confused here! You say:

What I need to do is delete all of the messages in this folder for every day except Friday.

So this is a manual process? On Tuesday morning you come to the office and have 10000 messages from Monday and you have to delete them, on wednesday morning you have 10000 messages from Tuesday night and delete etc, on Monday morning you have the 10000 messages from Friday and need to keep them? If that's the case, why not just run the job on Fridays so all you have in the folder on Monday is Friday's information?

I am able to create a new formula field that I can calculate the day of the week based upon the date, and display it as a field in the folder.

What date are you calculating the day of the week? Today's date or some date in the email in the folder? If it's a date within the email, why don't you just delete the email if the date is not a Friday?

Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Sorry, maybe I wan't clear.

The 10000 emails have come over the last 5 years or so. We usually get about 10 per night. We just determined that we only need to retain the Friday emails.

Going forward, we will only be receiving emails on Fridays, which is fine. But I need to correct everything that was done in the last 5 years!

The date I am using is the sent date included in the email.

Hope this clarifies things.

 
So for each email in the folder you want to check the sent date and if it's not a Friday delete it. Something like this should work:
Code:
Dim fs, f, f1, fc
    
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
   if Weekday(f1.Sent) <> 6 then
      f1.delete
Next
Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top