Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access/Office Automation (Office 2K, Win 2K Pro)

    <font color=red>never mind! I forgot I have already asked this question...</font color=red>

    This is more of an office automation question than an Access one, but I thought I'd start here...

    I know how to get Access/VBA to generate an E-mail for notifying people of some action. Is there a way to create an Outlook Task as well?

  2. #2
    Star Lounger
    Join Date
    Jul 2006
    Location
    Colorado, USA
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access/Office Automation (Office 2K, Win 2K Pro)

    After you reference Outlook in Tools > References, use something similar to this:

    Sub AddMyTask()
    Dim myOutlookApp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myMAPIFolder As Outlook.MAPIFolder
    Dim myTaskItem As Outlook.TaskItem
    Dim myItem As Outlook.Items

    Set myOutlookApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOutlookApp.GetNamespace("MAPI")
    Set myMAPIFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
    Set myItem = myMAPIFolder.Items
    Set myTaskItem = myItem.Add("IPM.Task.myTask")
    myTaskItem.Subject = "Get out of bed"
    myTaskItem.Importance = olImportanceHigh
    myTaskItem.Save

    End Sub

    There are a lot of other properties you can set for my TaskItem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •