S
Sydney
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
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