View Single Post
  #1  
Old February 8th 06, 01:21 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Calendar looping through the current month?

See http://www.outlookcode.com/d/finddate.htm for examples of how to use it to return items in a date range.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Michael Bauer" wrote in message ...
Am Wed, 8 Feb 2006 14:27:56 +1100 schrieb Sydney:


You can use the Restrict function to get a particular range.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --

Hi All

From Word XP, I am successfully using this code that i found on the net.
It loops through the calendar items and warns when a particular subject is
found. The problem is, it searches the entire calendar going back 2

years.

Is it possible to get this to loop through the curent month or current

week?
Thanks in advace

Sub GetAppt()

Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim olFldr As MAPIFolder
Dim olApt As AppointmentItem
Dim myDate As Date

myDate = Date ' test

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set olFldr = olNs.GetDefaultFolder(olFolderCalendar)


For Each olApt In olFldr.Items
If olApt.Subject = "test" Then
MsgBox "yes"
Debug.Print olApt.Subject, Format(olApt.Start, "mm/dd/yy")
End If

Next olApt

Set olApt = Nothing
Set olFldr = Nothing
Set olNs = Nothing
Set olApp = Nothing

End Sub

Ads