![]() |
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 |
#1
|
|||
|
|||
![]()
I currently log onto Outlook using my personal account.
I also have access to a shared mailbox which is showing in my folder list. I have the following code which I cannot get to work. The bit I'm trying to sort out is the: 3. To move the item: ' NOTE: You need to first define olDestFolder where would I define the olDestFolder? TIA Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder) Dim i As Long Dim olNewFolder As Outlook.MAPIFolder Dim olDestFolder As Outlook.MAPIFolder ' late bind this object variable, since it could be various item types Dim olTempItem As Object ' Set olNameSpace = olApp.GetNamespace("MAPI") ' Loop through the items in the current folder. ' Looping through backwards in case items are to be deleted, ' as this is the proper way to delete items in a collection. For i = CurrentFolder.Items.count To 1 Step -1 Set olTempItem = CurrentFolder.Items(i) ' Check to see if a match is found If InStr(1, olTempItem.Subject, strSearchString, 0) 0 Then ' The following are examples of what you can do: ' 1. To notify that message was found: 'MsgBox "Found message with subject: " & olTempItem.Subject ' ' 2. To delete the item: ' olTempItem.Delete ' ' 3. To move the item: ' NOTE: You need to first define olDestFolder 'olTempItem.Move olDestFolder lCountOfFound = lCountOfFound + 1 End If Next ' Loop through and search each subfolder of the current folder. For Each olNewFolder In CurrentFolder.Folders If olNewFolder.Name "Deleted Items" Then ProcessFolder olNewFolder End If Next End Sub |
Ads |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Deleted email account, where are the emails stored? | Colin Lourdes | Outlook - General Queries | 1 | April 18th 11 08:45 AM |
Moving email account details when moving pst file | efandango | Outlook - Installation | 3 | July 21st 09 09:27 AM |
Which Outlook email account when replying to emails? | Lobster | Outlook - General Queries | 22 | January 20th 09 01:39 PM |
moving emails to folders based on sender email address | Rudy L. | Outlook and VBA | 1 | December 31st 08 01:14 PM |
Moving Outlook account to another Windows log-in user account | chillinnsatx | Outlook - General Queries | 6 | July 20th 07 11:41 PM |