Start date of occurrence same as PatternStartDate

Status
Not open for further replies.

njs27

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Hi all,
I've been coding at a basic/intermediate level with vba in Excel for a bit, but I'm trying to understand some things about the Outlook format and I'm getting confused.

I've been asked by my boss to make a group calendar, basically by taking all the appointments from everyone in the group's calendars (for which I have been given permission to view full details) and dumping them into an Excel sheet.

I've managed to pull all the pertinent information, with one exception on the recurrences. With my calendar, the .Start is that occurrence in the correct chronological order. With everyone else's calendars, the items show up in the correct chronological order, but the .Start date is always the same as the .PatternStartDate. For example, if there is a weekly recurring appt that began on Feb 1, 2013, for this month (July 2014), the olkApt.Start and the RP.PatternStartDate both say 2/1/13.... even though it shows up in the middle of the July 2014 appointments.

Is this something I can fix? Or perhaps there is something fundamental I am missing, being new to the outlook part of vba?

Thanks for any help you can provide... I appreciate it!!

I will include some of the code below

'Write appointments to spreadsheet
For Each olkApt In olkRes
'Only export appointments
If olkApt.Class = olAppointment Then
For Each olkRec In olkApt.Recipients
strLst = strLst & olkRec.Name & ", "
Next
If strLst <> "" Then strLst = Left(strLst, Len(strLst) - 2)
'Add a row for each field in the message you want to export
excWks.Cells(lngRow, 1) = olkApt.Subject
excWks.Cells(lngRow, 2) = Format(olkApt.Start, "mm/dd/yyyy")
'...
'etc
'...

If olkApt.IsRecurring = True Then
Set RP = olkApt.GetRecurrencePattern
excWks.Cells(lngRow, 10) = RP.RecurrenceType
excWks.Cells(lngRow, 12) = RP.DayOfWeekMask
excWks.Cells(lngRow, 14) = RP.Instance
excWks.Cells(lngRow, 15) = RP.Interval
excWks.Cells(lngRow, 16) = RP.PatternStartDate
excWks.Cells(lngRow, 17) = RP.PatternEndDate
'....
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
You need to loop through the occurrences by calling GetOccurrence. With the Outlook object model it's not very effective to do as you need to pass a certain date. That is you either need to calculate every date yourself based on the pattern, or call the function for every day between start and end, and handle the case that it doesn't return an occurrence. This can be quite time consuming if it's a huge range of time.

The RDORecurrencePattern of the Redemption (www.dimastr.com) allows to pass the index instead of the date. That is you can call GetOccurrence from 1 to Occurrences (which is the count of occurrences). This can be a lot faster.

And don't forget to loop through the exceptions as well. For instance, if the pattern start time is 10 am, and if this has been changed for a few appointments on, say, 11 am, these appointments are accessible only through the Exceptions collection.
 

njs27

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Thanks, Michael. I will take a look at that.

I'm confused about why it shows up differently from my calendar vs other's calenders? Do you have any idea about that?
 

njs27

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Let me try it this way. When I perform the macro on my calendar, I get something like this for the recurring appointments:
Subject StartDate EndDate PatternStartDate Pattern EndDate
Subject A 6/5/14 6/5/14 5/29/14 12/30/14
Subject B 6/6/14 6/6/14 1/1/14 12/31/4500
Subject C 6/10/14 6/10/14 2/15/13 2/15/14
Subject A 6/12/14 6/12/14 5/29/14 12/30/14
Subject A 6/19/14 6/19/14 5/29/14 12/30/14

Where when I run the same macro on my boss's calendar (for the same appointments), the output is this:
Subject StartDate EndDate PatternStartDate Pattern EndDate
Subject A 5/29/14 12/30/14 5/29/14 12/30/14
Subject B 1/1/14 12/31/4500 1/1/14 12/31/4500
Subject C 2/15/13 2/15/14 2/15/13 2/15/14
Subject A 5/29/14 12/30/14 5/29/14 12/30/14
Subject A 5/29/14 12/30/14 5/29/14 12/30/14

The only thing that made me realize it was that the non-recurring appointments were all in order. So, on my boss's calendar, the StartDate is showing up as the PatternStartDate rather than the StartDate for the occurrence of the appointment (which is what is showing up when I run it on my calendar). Does that make more sense?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
The start date of the pattern and the one of each occurrence are not the same. The suggested solution works on both calendars, doesn't it?
 

njs27

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Michael, I'm sorry, I was answering the other poster's question. Yes, the start date should be the same as the pattern start date for the first occurrence, but not the others.

I have not yet tried to implement because I just got to my work computer a few minutes ago. I will try sometime this morning and let you know. :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L set task reminder date to same as start date (without affecting due date) Using Outlook 0
R Changing Start Date Without Changing Due Date in Tasks Using Outlook 1
R Phone Call Start Date - Phone Log BCM (Business Contact Manager) 1
witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
W Recurrence: delete older occurrences / change earliest start time Outlook VBA and Custom Forms 0
V Change start time based on message duration Outlook VBA and Custom Forms 2
A End-time meeting reminder (or "negative" time relative to the meeting start time) Using Outlook 1
N Multiple instances of Outlook on Start Menu Using Outlook 2
P Automate Outlook Start - No Active Explorer Object Found Using Outlook 10
P Outlook 2016 won't Start Using Outlook 3
M Outlook 2013 fails to start -- missing WindowsCodecs.dll error Using Outlook 3
O Outlook 2016 crashes at start Using Outlook 14
S Calendar loops when clicking on calendar link to start it Using Outlook 1
Diane Poremsky Cannot start Microsoft Office Outlook Error Message New Slipstick.com Articles 0
A BCM crashes immediately after start BCM (Business Contact Manager) 2
Thorsten show the correct calendar on start Outlook VBA and Custom Forms 5
V Cannot start Outlook. Cannot open the Outlook window. Using Outlook 8
M Cannot start MS Office Outlook Cannot open the Outlook window Using Outlook 2
R Default Start time for Private Appointment Using Outlook 4
E Searching a Shared Outlook Mailbox from the start menu? Using Outlook 4
S Using "start application" rule action Using Outlook 2
A BCM does not start correctly BCM (Business Contact Manager) 10
M Clipboard Manager Not showing in Outlook 2010 on Start Using Outlook 8
L Outlook 2007 does not start with Apple iCloud-Add-In activated Using Outlook 2
V How can I start a NEW PST file without loosing my contacts & other data Using Outlook 3
D How do I start completely from scratch in setting up Outlook 2013? Using Outlook 6
P Outlook 2010 fails to start after icloud update Using Outlook 3
C Monday Start Monthly Template Calendar Printing Assistant 0
L Change length of appointment start time Using Outlook 2
G Cannot start Microsoft Outlook Using Outlook 1
M I cannot start Microsoft Outlook 2013 directly opening a .eml message Using Outlook 1
E Adding Start and End Time to Daily View in Calendar Printing assistant Calendar Printing Assistant 1
H Outlook 2010: Cannot start!, please help me! Using Outlook 3
D Task Start and Due Dates Using Outlook 3
M Outlook wont start Using Outlook 1
N How can i hsve appointments and events to not display start or finish times Using Outlook 2
W Auto changing "You" at start of sentence...very frustrating! Using Outlook 4
E cannot start Microsoft Office Outlook. Cannot open the Outlook Window. Using Outlook 1
G How to NOT display the start time in monthly calendar view - 2007 Using Outlook 8
J Outlook 2010 won't start in Win 7 Using Outlook 4
S Cannot start Microsoft Office Outlook. Cannot open the Outlook window. The set of folders cannot be Using Outlook 3
S __Cannot start Microsoft Office Outlook. Cannot initialize Microsoft Office shared utilities.____ Using Outlook 4
N Start my Outlook from a server Outlook VBA and Custom Forms 1
A General, how to get started? [kwrds begin start newbie] Outlook VBA and Custom Forms 3
T MSSMLBIZ will not start after a Windows XP Repair BCM (Business Contact Manager) 4
Q I cannot start Outlook 2007 I keep getting this error: __'Cannot start outlook window. Invalid XML,the view cannot be loaded.' Using Outlook 3
T Cannot Start MS Office Outlook - Cannot open office window BCM (Business Contact Manager) 1
K Cannot start outlook Outlook Wishlist 1
M Phone Message form in outlook 2007. How to start? Outlook VBA and Custom Forms 2
A VBA Editor doesn't Start Outlook VBA and Custom Forms 1

Similar threads

Top