title image


Smiley Re: Outlook-Termine löschen
Das geht so:



Public Function DeleteOutlookAppointment(SDate, Optional EDate, Optional Subject, Optional Body)



Dim myOlApp As Outlook.Application, aItm As Outlook.AppointmentItem, OK As Boolean, _

myNameSpace As Outlook.NameSpace, myFolder As Object, I As Long



On Error Resume Next

Set myOlApp = GetObject(, "Outlook.Application")

If myOlApp Is Nothing Then Set myOlApp = CreateObject("Outlook.Application")

On Error GoTo 0

If myOlApp Is Nothing Then

MsgBox "Kann Outlook nicht initialisieren!", vbExclamation

Else

Set myNameSpace = myOlApp.GetNamespace("MAPI")

Set myFolder = myNameSpace.GetDefaultFolder(olFolderCalendar)



' Termin löschen

For I = 1 To myFolder.Items.Count

Set aItm = myFolder.Items(I)

With aItm

OK = False

If Not IsMissing(Subject) Then

If .Subject = Subject Then OK = True

End If

If Not IsMissing(SDate) Then

If .Start = SDate Then OK = True

End If

If Not IsMissing(Body) Then

If .Body = Body Then OK = True

End If

If Not IsMissing(EDate) Then

If .End = EDate Then OK = True

End If

If OK Then

.Delete

Exit For

End If

End With

Next I

End If



Ex:

On Error Resume Next

Set myOlApp = Nothing

Set aItm = Nothing

Exit Function

End Function



Verweis auf die Outlook-Objektbibliothek setzen!


Gruß aus dem Norden
Reinhard


Bitte immer die Access-Version angeben!
DB-Wiki


Wie man Fragen richtig stellt

YaccessAccess-FAQUnd ansonsten: Wikipedia




geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: