Create task for supervisor (day before the appointment):
Set fldTasks = _
appOutlook.Session.GetDefaultFolder(olFolderTasks)
Set tsk = fldTasks.Items.Add
With tsk
.StartDate = DateAdd(“d”, -1, dteNextReviewDate)
.DueDate = DateAdd(“d”, -1, dteNextReviewDate)
.ReminderSet = True
.ReminderPlaySound = True
.Subject = “Prepare materials for “ & strEmployeeName _
& “ review”
.Close (olSave)
End With
strTitle = “Done”
strPrompt = dteNextReviewDate _
& “ appointments scheduled for “ _
& strEmployeeName & “ (employee) and “ _
& strSupervisorName _
& “ (supervisor) and a task scheduled for “ _
& strSupervisorName
MsgBox strPrompt, vbOKOnly + vbInformation, strTitle
End Sub
The code first attempts to set references to the supervisor’s and employee’s folders under the default
Calendar folder. If there is no folder for the employee (or supervisor), it then creates a new folder
for the employee or supervisor, using the Addmethod of the Calendar folder’s Folders collection.
Next, the Items collection of the supervisor’s folder is used to create a new item of the default item
type in that folder, and similarly for the employee’s folder. You can also create a new item using the
CreateItemmethod of the Outlook Application object, but that creates the item in the default
folder; if you want to create an item in a custom folder, you need to use the Addmethod instead.
You can’t use the Addmethod directly with an Outlook folder; this method works with
collections, such as the Items collection or the Folders collection.
Finally, you will get a “Done” message (Figure 4.3) reporting on the appointments and task that
have been scheduled.
Figure 4.4 shows several employee and manager folders under the default Calendar folder, and a
supervisor appointment in the daily calendar.
If you don’t see the employee and manager folders, you are probably in another view;
NOTENOTE switch to Folder view to see the calendar folders.
NOTENOTE
Organizing and Communicating with Outlook 4