![]() |
#1
|
|||
|
|||
![]()
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 |
#2
|
||||
|
||||
![]()
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 |
#3
|
|||
|
|||
![]() Quote:
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 |
#4
|
||||
|
||||
![]()
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 |
#5
|
|||
|
|||
![]()
Thanks. how to lunch that script?
|
#6
|
||||
|
||||
![]()
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 |
![]() |
|
![]() |
||||
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 |
![]() |
scvjudy | Word | 2 | 08-11-2014 10:58 PM |
![]() |
Eebygum | Outlook | 3 | 06-17-2013 06:10 AM |
![]() |
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 |