Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2016, 01:55 AM
samifox samifox is offline rule for looking for keywords and open a folder Windows XP rule for looking for keywords and open a folder Office 2010 32bit
Novice
rule for looking for keywords and open a folder
 
Join Date: May 2012
Posts: 8
samifox is on a distinguished road
Default rule for looking for keywords and open a folder

Hi



Using outlook 2016,

In the office we have a software for project management where projects are being names with numbers, and we have folders corresponding to those numbers with the project files.
When getting emails from clients:
1. we must understand which project is all about
2. go to the management software
3. type the project name
4. go to explorer
5. locate the files
I want to create a rule in outlook that search for predefined keywords and link it with the project number and than open the folder

For example:

"outlook please, when email arrive and on existing mails, look for the keywords "David Green house" | if you find :

1. Show a note with the project number
2. open directory s:/2465/cons"
Thanks
Shay
Reply With Quote
  #2  
Old 05-04-2016, 04:07 AM
gmayor's Avatar
gmayor gmayor is offline rule for looking for keywords and open a folder Windows 10 rule for looking for keywords and open a folder Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

I think you have over simplified this requirement to the point where it has become meaningless.
1. Where are the keywords to be found? In the message body or the message subject?
2. Are you looking for any or all of the three individual words, or the complete phrase "David Green house".
3. In this context is 'house' always in lower case?
4. What is the relationship between this phrase and the Windows folder?
5. Presumably "David Green house" relates to just one project? What about other projects (see 4 above), or are you only interested in this one?
6. Show a note where?
7. What exactly do you want to happen at 'open directory'?
__________________
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-04-2016, 06:59 AM
samifox samifox is offline rule for looking for keywords and open a folder Windows XP rule for looking for keywords and open a folder Office 2010 32bit
Novice
rule for looking for keywords and open a folder
 
Join Date: May 2012
Posts: 8
samifox is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
I think you have over simplified this requirement to the point where it has become meaningless.
1. Where are the keywords to be found? In the message body or the message subject?
2. Are you looking for any or all of the three individual words, or the complete phrase "David Green house".
3. In this context is 'house' always in lower case?
4. What is the relationship between this phrase and the Windows folder?
5. Presumably "David Green house" relates to just one project? What about other projects (see 4 above), or are you only interested in this one?
6. Show a note where?
7. What exactly do you want to happen at 'open directory'?
1. in the subject i think
2.AND
3.what diffrent does it make?
4.a database should be built by time where a phrase will be linked to a project number(etc david,green,house = s:/2465/cons)
5.i think since a phrase can be relevant to more than one project, only true for AND operator (david+green+house) will lunch the folder. when a phrase is relevant to more than one project a list should be cvonsidered.
6.on the top of the phrase
7.nothing' just want windows to go there and let me access

by the database i mean pretty much like the spam database where you can add emails addresses to a black list.

thanks
Reply With Quote
  #4  
Old 05-05-2016, 04:31 AM
gmayor's Avatar
gmayor gmayor is offline rule for looking for keywords and open a folder Windows 10 rule for looking for keywords and open a folder Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

1. OK
2. AND? I assume you mean ALL?
3. VBA text strings are case sensitive. I have assumed that case is not important.
4. OK Save the strings one to a line with their associated paths in a text file in the following format and change the code to reflect the full path and filename of the text file:
David+Green+house|s:\2465\cons\
i.e. use + between the search strings and separate the path from the search with a pipe character '|'. Note folder separators are \ not /
6. I don't know what that means. The code will show a message box with the folder name
7. and will open the folder in Windows FileExplorer.

You can use the test macro to test on files in the inbox, and/or use the main macro as a script associated with a rule that identifies the messages to be searched.

Code:
Option Explicit
Sub TestSelectedMessage()
    Dim olMsg As MailItem
    On Error Resume Next
    Set olMsg = ActiveExplorer.Selection.Item(1)
    CheckMail olMsg
lbl_Exit:
    Exit Sub
End Sub

Sub CheckMail(olItem As Outlook.MailItem)
Dim sSubject As String
Dim sTextRow As String
Dim sSearch As String
Dim vSearch As Variant
Dim sPath As String
Dim sFileName As String: sFileName = "C:\Path\CheckList.txt" 'change as appropriate
Dim iFileNo As Integer: iFileNo = FreeFile
Dim i As Integer
Dim j As Long
    Open sFileName For Input As #iFileNo
    sSubject = LCase(olItem.subject)

    Do While Not EOF(iFileNo)
        Line Input #iFileNo, sTextRow
        i = 0
        sPath = Split(sTextRow, "|")(1)
        sSearch = Split(sTextRow, "|")(0)
        vSearch = Split(sSearch, "+")
        For j = LBound(vSearch) To UBound(vSearch)
            If InStr(1, sSubject, LCase(vSearch(j))) > 0 Then
                i = i + 1
            End If
        Next j
        If i = UBound(vSearch) + 1 Then
            MsgBox sPath
            GetFolder sPath
            Exit Do
        End If
    Loop
    Close #iFileNo
End Sub

Sub GetFolder(strFolder As String)
    Shell "C:\Windows\SysWOW64\explorer.exe /root," & strFolder, vbNormalFocus
lbl_Exit:
    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
  #5  
Old 05-05-2016, 05:05 AM
samifox samifox is offline rule for looking for keywords and open a folder Windows XP rule for looking for keywords and open a folder Office 2010 32bit
Novice
rule for looking for keywords and open a folder
 
Join Date: May 2012
Posts: 8
samifox is on a distinguished road
Default

Thanks. how to lunch that script?
Reply With Quote
  #6  
Old 05-06-2016, 09:06 PM
gmayor's Avatar
gmayor gmayor is offline rule for looking for keywords and open a folder Windows 10 rule for looking for keywords and open a folder Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

Either select a message and run the TestSelectedMessage macro, or associate the main CheckMail macro with a rule that identifies the messages to be processed. The rule then runs as the messages arrive.
__________________
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA rule to fire off in specified folder only AndyDDUK Outlook 2 11-17-2015 10:05 PM
rule for looking for keywords and open a folder How to open Documents folder directly from CTRL+O of Open folder on QAT scvjudy Word 2 08-11-2014 10:58 PM
rule for looking for keywords and open a folder Can't select specified folder when creating rule Eebygum Outlook 3 06-17-2013 06:10 AM
rule for looking for keywords and open a folder Rule will not save on Publc Folder doppers Outlook 2 07-18-2011 05:27 AM
Having trouble with keywords in Outlook Rule mfarring Outlook 0 02-03-2010 08:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:50 PM.


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