A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , ,

Sorting Appointments Chronologically





 
 
Thread Tools Display Modes
  #1  
Old September 7th 07, 03:02 PM posted to microsoft.public.outlook.program_vba
Daniel
external usenet poster
 
Posts: 35
Default Sorting Appointments Chronologically

I am using the following code to loop through all the appointment in Outlook

***
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objCalendarFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objCalendarFolder = objNS.GetDefaultFolder(olFolderCalendar)
Set objItems = objCalendarFolder.Items.Restrict("[Start] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")

For Each objAppt In objItems
...
***

It does work, but is there a way to control the chrononlogical order of the
returned appointments? Is there a way to sort the ObjItems
Assending/Descending depending on my needs?

Thank you,

Daniel P
Ads
  #2  
Old September 7th 07, 03:13 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,779
Default Sorting Appointments Chronologically

How about using the Items.Sort() method?

Look up the arguments for that method in the Object Browser Help, you can
sort on a property and make it ascending or descending.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Daniel" wrote in message
...
I am using the following code to loop through all the appointment in
Outlook

***
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objCalendarFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objCalendarFolder = objNS.GetDefaultFolder(olFolderCalendar)
Set objItems = objCalendarFolder.Items.Restrict("[Start] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")

For Each objAppt In objItems
...
***

It does work, but is there a way to control the chrononlogical order of
the
returned appointments? Is there a way to sort the ObjItems
Assending/Descending depending on my needs?

Thank you,

Daniel P


  #3  
Old September 7th 07, 03:38 PM posted to microsoft.public.outlook.program_vba
Daniel
external usenet poster
 
Posts: 35
Default Sorting Appointments Chronologically

I will take a look! Thank you for putting me on the right path.

Daniel P




"Ken Slovak - [MVP - Outlook]" wrote:

How about using the Items.Sort() method?

Look up the arguments for that method in the Object Browser Help, you can
sort on a property and make it ascending or descending.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Daniel" wrote in message
...
I am using the following code to loop through all the appointment in
Outlook

***
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objCalendarFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objCalendarFolder = objNS.GetDefaultFolder(olFolderCalendar)
Set objItems = objCalendarFolder.Items.Restrict("[Start] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")

For Each objAppt In objItems
...
***

It does work, but is there a way to control the chrononlogical order of
the
returned appointments? Is there a way to sort the ObjItems
Assending/Descending depending on my needs?

Thank you,

Daniel P



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Appointments - Sorting nikki Outlook - Calandaring 1 August 15th 07 06:25 AM
Sorting vortex2k4 Outlook and VBA 1 July 19th 06 01:52 PM
Sorting doesn't work Peter Kim Outlook - Using Contacts 3 February 15th 06 05:31 PM
grouping / sorting Stuart Outlook - Using Contacts 2 February 4th 06 12:43 PM
How does OE6 do second level sorting? D. W. K. Outlook Express 8 January 17th 06 11:07 PM


All times are GMT +1. The time now is 05:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Web Advertising - Mortgage Calculator - Bad Credit Loan - Mortgages - Mortgages