Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2017, 06:33 PM
BudVitoff BudVitoff is offline OL 2016.  "Running rule now" stops too soon. Windows 7 64bit OL 2016.  "Running rule now" stops too soon. Office 2007
Advanced Beginner
OL 2016.  "Running rule now" stops too soon.
 
Join Date: Sep 2011
Posts: 52
BudVitoff is on a distinguished road
Default OL 2016. "Running rule now" stops too soon.


Running Outlook 2016 under Win10, working offline.

I created a simple "Run Now" rule to scan a folder containing 2005 messages and move any message with a certain recipient to a temporary folder. I know there are 250 messages with that recipient, but my rule finds only two of them.

This effort is about as simple as you can get, so I'm doing something very dumb -- I just don't know what it is.

Any ideas?
Reply With Quote
  #2  
Old 05-05-2017, 06:36 AM
gmayor's Avatar
gmayor gmayor is offline OL 2016.  "Running rule now" stops too soon. Windows 10 OL 2016.  "Running rule now" stops too soon. Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Use the following macro instead. I have provided alternative lines for messages to someone and from someone. In the case of To, it does not include messages with multiple addresses in 'To ' nor messages where the address is in CC or BCC. For those you would have to loop though the recpients.

Code:
Sub MoveMessages()
Dim olFolder As Outlook.Folder
Dim olItems As Outlook.Items
Dim olItem As Outlook.MailItem
Dim i As Long
Dim strAddress As String
Dim strFolder As String

    strAddress = "someone@somewhere.com"
    strFolder = "Temp" 'subfolder of the default Inbox - must exist
    Set olItems = Session.PickFolder.Items 'Pick the folder containing the messages
    olItems.Sort "[Received]", True
    For i = olItems.Count To 1 Step -1
        Set olItem = olItems(i)
        'If olItem.SenderEmailAddress = strAddress Then 'Messages from someone
        If olItem.To = strAddress Then    'messages to someone
            olItem.Move Session.GetDefaultFolder(olFolderInbox).folders(strFolder)
        End If
        DoEvents
    Next i
    MsgBox "Messages Moved"
lbl_Exit:
    Set olItems = Nothing
    Set olItem = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 05-05-2017, 05:25 PM
BudVitoff BudVitoff is offline OL 2016.  "Running rule now" stops too soon. Windows 7 64bit OL 2016.  "Running rule now" stops too soon. Office 2007
Advanced Beginner
OL 2016.  "Running rule now" stops too soon.
 
Join Date: Sep 2011
Posts: 52
BudVitoff is on a distinguished road
Default

Thanks for your response. It brought back some fond memories of BASIC, although I have to admit that I don't know how and where to invoke your subroutine.

Be that as it may, you didn't answer my question which is simply: Why does this rule
Apply this rule after the message arrives
with xxx in the recipient's address
move it to the yyy folder
and stop processing more rules
find only two qualified messages when I know there are 250 in the input folder?

I hope other visitors here will not hesitate to give an answer because "you've already answered it".
Reply With Quote
  #4  
Old 05-09-2017, 07:56 PM
BudVitoff BudVitoff is offline OL 2016.  "Running rule now" stops too soon. Windows 7 64bit OL 2016.  "Running rule now" stops too soon. Office 2007
Advanced Beginner
OL 2016.  "Running rule now" stops too soon.
 
Join Date: Sep 2011
Posts: 52
BudVitoff is on a distinguished road
Exclamation

My bad.

The rule works just fine. I came to some wrong conclusions because I mis-used Outlook's Search function.

Admin: We can close/delete/whatever this thread.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
OL 2016.  "Running rule now" stops too soon. Word 2014: WPerfect 6.x full-justification "stops working" dan_1 Word 12 01-24-2017 12:43 PM
OL 2016.  "Running rule now" stops too soon. Erroneously checked "Ignore Rule" while editing BorderDrama Word 1 12-11-2014 01:40 AM
OL 2016.  "Running rule now" stops too soon. Temporarily Removing "Email Delay" Rule tac383 Outlook 2 12-01-2011 01:19 PM
OL 2016.  "Running rule now" stops too soon. How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM
Business Contact Manager "assigned to" restriction rule? kossae Outlook 0 05-25-2011 10:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft