1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| Sub SearchByAddress()
'---------------------------------------------------------------------------------------------------------------------
' Auteur : Oliv- adapté du code suivant http://www.slipstick.com/developer/instant-search-messages-selected-contact/
' Idée : Trarc
' Date : 23/06/2016
' OS_App : Win 8.1_OL-2007
' But : Automatiser la commande "Rechercher tout/Message de l'expéd" pour trier rapidement les messages d'un dossier.
'---------------------------------------------------------------------------------------------------------------------
'Vérifier l'ouverture de OUTLOOK :
'Excel pratique par ouf746 » 26 janvier 2017, 15:08
Dim oOutlook As Object
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
Shell "Outlook.exe", vbHide
End If
'***
Dim myOlApp As New Outlook.Application
Dim ns As Outlook.Namespace
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim txtSearch As String
Set ns = myOlApp.GetNamespace("MAPI")
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
txtSearch = frmSaisie.txtEmail 'myOlSel.Item(1).SenderName
myOlExp.Search txtSearch, olSearchScopeCurrentFolder
'Mettre OUTLOOK devant
'Excel pratique par fred2406 » 16 février 2018, 18:55
Outlook.ActiveWindow.WindowState = 0
Set myOlApp = Nothing
Set myOlExp = Nothing
Set myOlSel = Nothing
End Sub |
Partager