Ich benötige mal wieder Eure Hilfe. Mit nachfolgendem Code übertrage ich Termine von Excel nach Outlook.
Option Explicit
Sub Outlooktermine_eintragen()
Dim OLApp As Outlook.Application
Dim apptOutlook As Outlook.AppointmentItem
Dim lastrow As Integer
Dim OLCalName As Object
Dim myPersCal As Object
Dim i As Integer
Dim Suchkriterium As String
Dim intRow As Integer
Set OLApp = CreateObject("Outlook.Application")
Set OLCalName = OLApp.GetNamespace("MAPI")
Set myPersCal = OLCalName.GetDefaultFolder(olFolderCalendar)
lastrow = ActiveSheet.Cells(Rows.Count, 5).End(xlUp).Row
For intRow = 3 To lastrow
If Cells(intRow, 5) "" Then
'Durchsuchen, ob es den Termin bereits gibt.
'Wenn ja, löschen
Suchkriterium = Cells(intRow, 2)
For i = myPersCal.Items.Count To 1 Step -1
If myPersCal.Items(i).Subject = Suchkriterium Then
myPersCal.Items(i).Delete
End If
Next
'Neuen Termin eintragen
Set apptOutlook = OLApp.CreateItem(olAppointmentItem)
With apptOutlook
.Subject = Suchkriterium
.Body = Cells(intRow, 3).Value
.Location = Cells(intRow, 4).Value
.Start = Cells(intRow, 5)
.Duration = Cells(intRow, 6).Value
.ReminderMinutesBeforeStart = 10
.ReminderPlaySound = True
.ReminderSet = True
.Save
End With
End If
Next
Set OLApp = Nothing
Set OLCalName = Nothing
Set myPersCal = Nothing
Set apptOutlook = Nothing
End Sub
Dabei stehen in Spalte B der Betreff, in Spalte C Text in dem Termin, in Spalte D der Ort des Termins, in Spalte E das Datum und die Uhrzeit (getrennt durch ein Leerzeichen) und in Spalte F die Dauer des Termins.Nun möchte ich aber auch noch angeben, dass diverse Termine Serientermine sind. Ich möchte also noch angeben, ob täglich, wöchentlich, monatlich oder jährlich und wann der Termin endet, also nach x Terminen oder an einem bestimmten Datum.
Das Problem ist nur, ich weiß nicht wie. Daher hoffe ich auf Euer Wissen.
Ich hoffe also, dass mir jemand weiterhelfen kann.
Danke Euch schon mal im Vorraus,
Kasimir