![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#8
|
|||
|
|||
![]()
Thanks you so much Michael and JP
I made the suggested change (At least I think I did – it still works anyway!) Your input lead me to ask some questions which I have added as comments. I really really appreciate your help. So here is the new code: Sub MoveToTrash() On Error Resume Next Dim objFolder As MAPIFolder Dim objNS As NameSpace Dim objItem As MailItem Set objNS = Application.GetNamespace("MAPI") Set objFolder = objNS.Folders("KJB").Folders("Trash") ' is this redundant since the folder name is hard coded and doesnt change?? If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" End If ' Is this test needed since it appears the FOR loop below takes care of this test If Application.ActiveExplorer.Selection.Count = 0 Then Exit Sub End If For Each objItem In Application.ActiveExplorer.Selection objItem.UnRead = False objItem.Move objFolder Next ' Do these items need to be set to nothing. Wont they be removed from the heap or stack when the sub() ends? Set objItem = Nothing Set objFolder = Nothing Set objNS = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Eliminate need for "Enable Macro" selection | cte67 | Outlook and VBA | 7 | August 21st 09 07:30 PM |
eliminate error message "Borlane Database Engine not installed" | Outlook 2007 needs help - | Outlook - Installation | 2 | June 5th 08 06:47 PM |
How do I edit "show time as" drop down selection? | DGarton | Outlook - Calandaring | 1 | November 29th 07 11:56 PM |
find/eliminate "active content" in a customized outlook form | TomS | Outlook - Using Forms | 1 | August 3rd 07 04:54 PM |
how to delete email address from "to" button selection | Buckskin | Outlook - Using Contacts | 2 | June 12th 07 12:56 AM |