Hallo,
ich habe ein Problem bei dem ich nicht weiter kommen und wollte mal fragen ob hier jemand Rat weiß. Ich habe ein Excel Makro, das eine Spalte mit Daten durchläuft und immer wenn ein Termin kurz bevor steht benachrichtigt es mich bei Outlook. Es sind feststehende Termine (quasi wie Geburtstage). Das Ganze funktioniert ganz gut, nur dass ich auch eine Nachricht für Daten bekomme die schon in der Vergangenheit liegen. Zwecks dessen wollte ich eine if Abfrage einbauen, die zum einen die Benachrichtigung stoppt und zum anderen das Datum um ein Jahr aktualisiert.
Beispiel: 29.09.2009 --> 29.09.2010
Hier mal der Code, bin leider nicht so findig in VBA
Sub Termine_to_Outlook()
Dim d As Date
Dim LDate As Date
Dim OutApp As Object, apptOutApp As Object
Range("F4").Select
Do Until ActiveCell.Value = ""
Set OutApp = CreateObject("Outlook.Application")
Set apptOutApp = OutApp.CreateItem(1) 'olAppointmentItem)
With apptOutApp
.Start = Format(ActiveCell.Value - 7, "dd.mm.yyyy") & " 08:00"
If Format(Now(), "dd.mm.yyyy") > Format(ActiveCell.Value, "dd.mm.yyyy") Then
ReminderSet = False
LDate = DateAdd("yyyy", 1, Now())
ActiveCell.Value = LDate
End If
.Subject = "" & ActiveWorkbook.Name & ""
.Subject = ActiveCell.Offset(0, 1)
.Body = "Redaktionsschluss"
.Location = ""
.Duration = "2"
.ReminderMinutesBeforeStart = 10
.ReminderPlaySound = True
.ReminderSet = True
.Save
End With
ActiveCell.Offset(1, 0).Select
Set apptOutApp = Nothing
Set OutApp = Nothing
Loop
MsgBox "Termine an Outlook übertragen!"
End Sub
Gruss Uli