Hi Sandra
Habe Code etwas angepasst und Sub daraus gemacht.
Aufruf:
Sub Initialize
Dim datum_von As String
Dim datum_bis As String
Dim Betreff As String
datum_von = "20.11.2007"
datum_bis = "23.11.2007"
Betreff="Ferien"
CreateAppointment datum_von,datum_bis,Betreff
End Sub
Sub CreateAppointment(Von As String,Bis As String,Betreff As String)
Dim session As New NotesSession
Dim dbMailbox As New NotesDatabase( "", "" )
Dim docAppointment As NotesDocument
Dim dateRange As NotesDateRange
Dim dauer As Integer
Dim tmpdate As String
Dim tmpdate2 As String
Dim datum_von As String
Dim datum_bis As String
Dim startDate As NotesDateTime
Dim endDate As NotesDateTime
Dim CalendarDateTime() As NotesDateTime
Dim user As NotesName
Dim i As Long
dbMailbox.OpenMail
If Not dbMailbox Is Nothing Then
Set startDate=New NotesDateTime(Von)
Set endDate=New NotesDateTime(Bis)
dauer=endDate.TimeDifference(startDate)/60/60/24
Set docAppointment=New NotesDocument(dbMailbox)
With docAppointment
.Form = "Appointment"
.subject = Betreff
.AppointmentType="2"
Set dateRange = session.CreateDateRange
tmpDate = Von + " 00:00:01"
tmpDate2 = Bis + " 23:59:59"
Set dateRange.StartDateTime = startDate
Set dateRange.EndDateTime = endDate
Set .TimeRange = dateRange
Redim CalendarDateTime(dauer)
For i=0 To dauer
Set CalendarDateTime(i)=New NotesDateTime(tmpDate)
CalendarDateTime(i).AdjustDay(i)
Next
.ReplaceItemValue "CalendarDateTime",CalendarDateTime
.ReplaceItemValue "_ViewIcon",9
.SequenceNum = 1
.OrgTable = "P0"
Set .StartDateTime = New NotesDateTime (tmpDate)
Set .StartDate = New NotesDateTime (tmpDate)
Set .EndDateTime = New NotesDateTime (tmpDate2)
Set .EndDate = New NotesDateTime (tmpDate2)
Set user=session.CreateName(session.UserName)
.Chair=user.Canonical
.Principal=user.Canonical
.ComputeWithForm False,False
.Save False,False
End With
End If
End Sub
Gruss
Remo