Hallo,
im Outlook gibt es doch z.B. bei den Emails oben das Suchfeld. Gebe ich dort was ein, zeigt Outlook die Elemente an, die auf die Suche passen. Die Suche kann man dann noch erweitern, z.B. dass in allen Ordnern oder nur im aktuellen Ordner gesucht werden soll.
Ich möchte nun via VBA erreichen, dass z.B. beim drücken einer Schaltfläche in einem Formular der gleiche Vorgang ausgelöst wird, als würde ich also die Suchfunktion von Outlook direkt nutzen. Die Ergebnisse sollen auch ganz normal im Outlook angezeigt werden.
Wie könnte ich das umsetzen?
Hallo!
das würde mich auch Interesieren, einfach wärs man könnte ein Macro aufzeichnen aber das geht ja nicht.
gefunden hab ich das hier
https://msdn.microsoft.com/de-de/vba/outlook-vba/articles/olsearchscope-enumeration-outlook (https://msdn.microsoft.com/de-de/vba/outlook-vba/articles/olsearchscope-enumeration-outlook)
https://msdn.microsoft.com/de-de/vba/outlook-vba/articles/application-advancedsearch-method-outlook (https://msdn.microsoft.com/de-de/vba/outlook-vba/articles/application-advancedsearch-method-outlook)
http://www.access-im-unternehmen.de/fileadmin/download/OutlookEnumerationen.txt (http://www.access-im-unternehmen.de/fileadmin/download/OutlookEnumerationen.txt)
LG Frank
Outlook.Application.ActiveExplorer.Search "suchbegriff",olSearchScopeCurrentFolder
Hallo!
hab das so zusammen gebastelt, geht aber nur wenn Outlook schonläuft, nicht ausgeblendet ist oder ausblenden beim Start Aktiviert
Hab auch keine Funktion gefunden mit der man Outlook Maximieren kann aus dem Tray
Public Function Outlook_Search(strSearch As String) As Boolean
Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
With objOutlook
.ActiveExplorer.Display
.Application.ActiveWindow.WindowState = olMaximized
.Application.ActiveExplorer.Search strSearch, olSearchScopeAllFolders
End With
End Function
Gruß Frank
Hi!
So läufte es auf wenn Ausblenden wenn Minimiert im Tray Sind bei mir in 2 unterschidlichen Modulen die Functionen und Outlook muss gestartet sein
Option Compare Database
Option Explicit
Private objOutlook As Outlook.Application
Public Property Get CreateOutlook() As Outlook.Application
On Error Resume Next
If objOutlook Is Nothing Then
Set objOutlook = GetObject(, "Outlook.Application")
If Err <> 0 Or objOutlook Is Nothing Then
Err = 0
Set objOutlook = New Outlook.Application
If Err <> 0 Or objOutlook Is Nothing Then
Beep
MsgBox "Verbindung zu Outlook kann nicht aufgebaut werden: " & _
Err.Description, vbSystemModal + vbCritical Or vbOKOnly, "Problem:"
Exit Property
End If
End If
End If
Set CreateOutlook = objOutlook
End Property
Public Function Outlook_Search(strSearch As String) As Boolean
Dim objOutlook As Outlook.Application
Dim expOutlook As Outlook.Explorer
Set objOutlook = CreateOutlook
Set expOutlook = objOutlook.Application.ActiveExplorer
expOutlook.Activate
With objOutlook
.ActiveExplorer.Display
.Application.ActiveWindow.WindowState = olMaximized
.Application.ActiveExplorer.Search strSearch, olSearchScopeAllFolders
End With
If Not expOutlook Is Nothing Then Set expOutlook = Nothing
If Not objOutlook Is Nothing Then Set objOutlook = Nothing
End Function
Grus Frank
Zitat von: Frank77 am Juni 02, 2018, 13:21:24So läufte es auf wenn Ausblenden wenn Minimiert im Tray Sind bei mir in 2 unterschidlichen Modulen die Functionen und Outlook muss gestartet sein
Warum muss Outlook gestartet sein?
Set objOutlook = New Outlook.Application sollte eine neue Outlook Instanz starten, wenn es nicht bereits läuft.
Hallo!
Das öffnet sich aber nur im Tray (Ausblenden wenn ist aktiviert) und mit gelbem Zahnrad in icon dann kommt der fehler 91 und Kann nicht maximiert werden.
Evtl. prüfen obs Läuft wenn nicht " Shell "Outlook.exe" " einbauen dann geht es und
Set expOutlook = objOutlook.Application.ActiveExplorer
fällt weg
Gruß Frank
Top. Besten Dank an Euch. Läuft klasse!