Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2021, 04:54 AM
MarcusD MarcusD is offline Serial appointment Windows 10 Serial appointment Office 2019
Novice
Serial appointment
 
Join Date: Dec 2021
Posts: 1
MarcusD is on a distinguished road
Default Serial appointment

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
I'm programming some years now with MS Access but no experiences so far with Outlook. My problem is that I do not understand why the appointment is setup wrongly (Right month and year but always using the current day instead of the one I use in the code).
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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial appointment 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
Serial appointment Increase serial number for every print atomtm Word 1 06-15-2012 05:39 AM
Serial appointment Serial Number Issue rehan5001 Excel 1 06-08-2011 02:46 AM
Serial appointment Help with Serial No. Macro pikerman Word VBA 3 05-14-2011 03:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft