Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Automate a Task in Outlook

COM and Automation

How to Automate a Task in Outlook

by  Mike Gagnon  Posted    (Edited  )
*// Folder Constants
#DEFINE olFolderCalendar 9
#DEFINE olFolderContacts 10
#DEFINE olFolderDeletedItems 3
#DEFINE olFolderInBox 6
#DEFINE olFolderJournal 11
#DEFINE olFolderNotes 12
#DEFINE olFolderOutBox 4
#DEFINE olFolderSentMail 5
#DEFINE olFolderTask 13
#DEFINE olBusy 2
#DEFINE True .T.
#DEFINE False .F.
#DEFINE olPrivate 2

*/ Importance Constants
#DEFINE olImportanceLow 0
#DEFINE olImportanceNormal 1
#DEFINE olImportanceHigh 2


*// Item Constants
#DEFINE olMailItem 0
#DEFINE olAppointmentItem 1
#DEFINE olContactItem 2
#DEFINE olTaskItem 3
#DEFINE olJournalItem 4
#DEFINE olNoteItem 5
#DEFINE olPostItem 6

*// Added a Folder Constant

#DEFINE olFolderTasks 13

*// Create the Outlook Object
Public oOutLookObject
oOutLookObject = CreateObject("Outlook.Application")

*// Added code for alternate creating of Task

oNameSpace=oOutlookObject.GetNameSpace("MAPI")
oTaskFolder=oNameSpace.GetDefaultFolder(olFolderTasks)
oTaskItem=oTaskFolder.Items.Add

WITH oTaskItem
.Subject = "My Subject"
.Body = "My Body"
.StartDate = date()
.DueDate = date() + 10
.ReminderSet = True
.ReminderTime = datetime() + 3600
.Categories = "Personal"
.Save
EndWith

release oTaskItem
release oOutLookObject


Mike Gagnon
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top