127132
Goto Top

Outlook 2013 - Suchen und Ersetzen ab bestimmten Datum

Guten Morgen zusammen!

Ich habe ine frage an die VBA-Könner.

Ich möchte in Outlook bei allen Terminen einen Text ersetzen. Aber erst ab einem bestimmten Datum.
Da ich VBA nicht drauf habe, habe ich mal im Netz gesucht und fast etwas passendes gefunden:

Sub FindReplaceAppointment()
    Dim oApp As Outlook.Application
    Dim oCalFolder As Outlook.MAPIFolder
    Dim oAppt As Outlook.AppointmentItem
    Dim sOldText As String
    Dim sNewText As String
    Dim iCalChangedCount As Integer
    Set oApp = Outlook.Application
    MsgBox ("This script will perform a find/replace in the subject line of all appointments in a specified calendar.")  
    sOldText = InputBox("What is the text string that you would like to replace?")  
    sNewText = InputBox("With what would you like to replace it?")  
    ' Check to be sure a Calendar folder was selected  
    Do
    If Not (oCalFolder Is Nothing) Then
        If (oCalFolder.DefaultItemType = olAppointmentItem) Then Exit Do
    End If
    MsgBox ("Please select a calendar folder from the following list.")  
    Set oCalFolder = Application.Session.PickFolder
    On Error GoTo ErrHandler:
Loop Until oCalFolder.DefaultItemType = olAppointmentItem
' Loop through appointments in calendar, change text where necessary, keep count  
iCalChangedCount = 0
For Each oAppt In oCalFolder.Items
    If InStr(oAppt.Subject, sOldText) <> 0 Then
        Debug.Print "Changed: " & oAppt.Subject & " - " & oAppt.Start  
        oAppt.Subject    = Replace(oAppt.Subject, sOldText, sNewText)
        oAppt.Save
        iCalChangedCount = iCalChangedCount + 1
    End If
Next
' Display results and clear table  
MsgBox (iCalChangedCount & " appointments had text in their subjects changed from '" & sOldText & "' to '" & sNewText & "'.")  
Set oAppt = Nothing
Set oCalFolder = Nothing
Exit Sub
    ErrHandler:
    MsgBox ("Macro terminated.")  
End Sub

Quelle: https://www.extendoffice.com/documents/outlook/2397-outlook-calendar-sea ...

Aber da kann ich das Datum nicht eingrenzen.
Kann mir da jemand helfen?

h.

Content-Key: 456350

Url: https://administrator.de/contentid/456350

Printed on: April 16, 2024 at 16:04 o'clock

Mitglied: 139920
Solution 139920 May 27, 2019 updated at 07:35:58 (UTC)
Goto Top
Zeile 24 ersetzen durch
If InStr(oAppt.Subject, sOldText) <> 0  and oAppt.Start >= CDate("20.05.2019") Then  
Mitglied: 127132
127132 May 27, 2019 at 07:37:50 (UTC)
Goto Top
Das hört sich selbst für mich Noob gut an.
Danke!