![]() |
|
#1
|
|||
|
|||
|
Hello,
I am now truly in despair. I am currently trying to create a series appointment in Outlook using another MS app. The appointment is to be entered in the student calendar, which works as far as it goes. However, the date is not correct. I use 03/10/2001 as a test date, but a repetition for 12 October is generated. Always for the current day instead of the test date one. The month is correct This is my test code: Code:
Sub TEST_SerialAppointment()
'---------------------------------------------------------------------
' Purpose: Creating a serial appointment in a specific calendar
'---------------------------------------------------------------------
Dim oOutlook As Outlook.application
Dim oNameSpace As Outlook.NameSpace
Dim oCalendar As Outlook.Folder
Dim oMyCalendar As Outlook.Folder
Dim oAppointment As Outlook.AppointmentItem
Dim datStart As Date
Const datBirthday As Date = "03/10/2001"
'the pattern shall start from today
datStart = DateSerial(Year(Date), Month(datBirthday), Day(datBirthday))
' create Outlook-Application-Objekt
Set oOutlook = CreateObject("Outlook.Application")
' Namespace
Set oNameSpace = oOutlook.GetNamespace("MAPI")
'Standard Calendar
Set oCalendar = oNameSpace.GetDefaultFolder(olFolderCalendar)
'My Calendar where the entry shall be made
Set oMyCalendar = oNameSpace.GetDefaultFolder(olFolderCalendar).Folders("student (Nur dieser Computer)")
'Entry
Set oAppointment = oMyCalendar.Items.Add
With oAppointment
.GetRecurrencePattern.RecurrenceType = olRecursYearly
.GetRecurrencePattern.Occurrences = 5
.GetRecurrencePattern.Duration = 24 * 60
.GetRecurrencePattern.PatternStartDate = datStart
.GetRecurrencePattern.StartTime = 0
.GetRecurrencePattern.EndTime = 0
.Subject = "Test_entry"
.Body = "test"
.BusyStatus = olFree
.Categories = "Test"
.Location = "location"
.AllDayEvent = True
.ReminderMinutesBeforeStart = 24 * 60
.Duration = 24 * 60
.Save
.Display
End With
On Error Resume Next
Set oOutlook = Nothing
Set oNameSpace = Nothing
Set oCalendar = Nothing
Set oMyCalendar = Nothing
Set oAppointment = Nothing
End Sub
When I setup this appointment manually in Outlook and read the settings out in VBA the values are the same as in the code. That confuses me a lot. Hopefully someone has a good hint for me. Kind regards |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Serial letter/envelope
|
Kuzcomerlin | Mail Merge | 1 | 06-09-2016 03:22 PM |
| Add a serial number to an invoice | pringle747 | Excel Programming | 6 | 02-19-2015 11:19 AM |
Increase serial number for every print
|
atomtm | Word | 1 | 06-15-2012 05:39 AM |
Serial Number Issue
|
rehan5001 | Excel | 1 | 06-08-2011 02:46 AM |
Help with Serial No. Macro
|
pikerman | Word VBA | 3 | 05-14-2011 03:29 PM |