PDA

View Full Version : Take information from a specific e-mail box in outlook



almanacht
07-29-2019, 06:39 AM
Hi all, I have to take information from a specific type of pattern in a sub mail box that I have in Outlook automatically using regex/vba, I did it but as you see I have multiple sub e-mail box, I put Private Sub Application_NewMail() to take automatically an information from the e-mail in "Dalet" (allsaw with Dim myfol As Outlook.Folder Set myfol = onamespace.GetDefaultFolder(olFolderInbox).Folders("Dalet") )
when I have an e-mail in my main Outlook mail box, I want to fix it to have an information from the e-mail in the "Dalet" automatically when I have an new e-mail in the "Dalet" section, do you know if I can change Sub Application_NewMail() to do or if there is another way ?


24701

gmayor
07-30-2019, 04:29 AM
The logical way to handle this is to create a rule that processes the messages that meet the required criteria as they arrive in the inbox, using a script attached to the rule that and then sends them to the appropriate sub folder. e.g.


Sub MyProcess(Item As Outlook.MailItem) With Item
'do stuff
End With
lbl_Exit:
Exit Sub
End Sub