sportsguy
Finance wiz, Access hack
- Local time
- Yesterday, 23:20
- Joined
- Dec 28, 2004
- Messages
- 363
Not sure where the best place is to post this question, so I am going to start here! Mods please move to best place!
Outlook 2003, i have a rule set up to move any email received with an attachment to my localInbox. All nonattachment email stays on the server.
At exit, i want to move all Inbox emails to my LocalInbox, with the exception of emails from Briefing.com, those are to be deleted.
Here is what i have so far, and it doesn't seem to work yet. .
any suggestions or criticisms are helpful . . .
sportsguy
location is ThisOutlookSession
Outlook 2003, i have a rule set up to move any email received with an attachment to my localInbox. All nonattachment email stays on the server.
At exit, i want to move all Inbox emails to my LocalInbox, with the exception of emails from Briefing.com, those are to be deleted.
Here is what i have so far, and it doesn't seem to work yet. .
any suggestions or criticisms are helpful . . .
sportsguy
location is ThisOutlookSession
Code:
Public Sub Application_Quit()
Dim Item As Object
Dim Cancel As Boolean
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim localFolder As Outlook.Folders
Dim olItem As Outlook.MailItem
Dim strSubject As String
Set olNS = Application.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
Set Item = olFolder.Items.GetFirst
For Each Item In olFolder.Items
Set olItem = Item.Copy
If InStr(olItem.Body, "Briefing.com") Then
olItem.Delete
Else
olItem.Move (localFolder.Folders("LocalInbox"))
End If
olItem.Close olDiscard
Next
Set Item = Nothing
Set olItem = Nothing
Set olFolder = Nothing
Set olNS = Nothing
End Sub
Last edited: