Create a Task when a message is flagged

Last reviewed on December 30, 2013   —  33 comments

You can use the ItemChange event to watch for any change to an item. In this example, the code watches for the QuickFlag block to be clicked then creates a task for the message.

In addition, the flag is cleared and a category applied to the message, so you know that a task exists for the item. Remove those lines if you want the message flag to remain.

This macro needs to go into ThisOutlooksession. To test the macro, click in Initialize_handler then click the Run button. Flag a message and the macro should create a task, displaying it onscreen.

See How to use the VBA Editor if you don't know how to use macros.

Public WithEvents OlItems As Outlook.Items

Public Sub Initialize_handler()
   Set OlItems = Application.GetNamespace("MAPI"). _
        GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub OlItems_ItemChange(ByVal Item As Object)
      
If Item.IsMarkedAsTask = True Then

Dim Ns As Outlook.NameSpace
Dim olTask As Outlook.TaskItem

Set Ns = Application.GetNamespace("MAPI")

Set olTask = Ns.GetDefaultFolder(olFolderTasks) _
    .Items.Add(olTaskItem)

With olTask
        .Subject = Item.Subject
        .Attachments.Add Item
        .Body = Item.Body
        .DueDate = Now + 1
        .Save
        .Display
End With

With Item
 .ClearTaskFlag
 .Categories = "Task"
 .Save
End With 

Set Ns = Nothing

End If


End Sub

Set Categories based on the chosen flag

This code sample uses the flags (today, tomorrow, this week, next week) to set the Task due date and determine the category assigned to the email.

This code subtracts today's date from the due date then matches the result with a category. "No date" actually uses a date in year 4501 and in my sample code, I'm looking for differences greater than 20 days.

Public WithEvents OlItems As Outlook.Items

Public Sub Initialize_handler()
    Set OlItems = Application.ActiveExplorer.CurrentFolder.Items
End Sub

Private Sub OlItems_ItemChange(ByVal Item As Object)

If Item.IsMarkedAsTask = True Then
     Dim Ns As Outlook.NameSpace
     Dim olTask As Outlook.TaskItem
     Dim newAttachment As Outlook.Attachment
     Dim aDate  As Date
    Dim cat As String
    
    Set Ns = Application.GetNamespace("MAPI")
    Set olTask = Ns.GetDefaultFolder(olFolderTasks).Items.Add(olTaskItem)
    Set newAttachment = olTask.Attachments.Add(Item, Outlook.OlAttachmentType.olEmbeddeditem)
    aDate = Format(Now, "mm/dd/yyyy")

    With olTask
        .Subject = Item.Subject
        .DueDate = Item.TaskDueDate
        .Save
        .Display
    End With
   

Select Case Item.TaskDueDate - aDate

    Case 0
         cat = ".Today"
    
    Case 1, 2
        cat = ".SOON"
    
    Case 3, 4, 5, 6, 7
        cat = ".WEEK"
    
    Case Is <= 20
        cat = ".FUTURE"
    
    Case Is > 20
       cat = ".NO DATE"
        
End Select
    
With Item
    .ClearTaskFlag
    .Categories = cat
    .Save
End With

Set Ns = Nothing
End If

End Sub

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

33 responses to “Create a Task when a message is flagged”

  1. Donald Terrell

    I am trying to use use a macro in this site:
    http://community.spiceworks.com/how_to/show/1964-add-a-button-to-outlook-that-will-forward-an-e-mail-to-the-helpdesk-as-a-new-ticket#comments
    I have the macro working, but I would like to have the ability to Pause it, display, and be able to have 2 drop down boxes for selections that would be imbedded in the mail and sent to our ticket system.

    any chance you can contact me on this.

    Donald

  2. Donald Terrell

    Sorry Diane I posted to the wrong page - I should have posted to your "Outlook Userform and Combo boxes"
    This is what I get when the mail displays:pauses
    #created bymailman-owner@csc.noaa.gov
    #assign Donald Terrell
    #mute on
    #close
    After the #assign - via through your combo box - I would like to select and place a "Category" and "Time"

    #created bymailman-owner@csc.noaa.gov
    #assign Donald Terrell
    #Category GIS
    #add 5m
    #mute on
    #close
    He is the string I have in my macro
    'adds the senders e-mail address as the created by object for the ticket and appends the message body
    strbody = "#created by" & senderaddress & vbNewLine & "#assign Donald Terrell" & vbNewLine & "#mute on" & vbNewLine & "#close " & vbNewLine & vbNewLine & objItem.Body
    What I am trying to do is use your Combo Box to stop my macro, hit your combo box, insert certain stuff into it in the above mail display with the #'s.... what this will do is insert a #Category GIS, and #add 5m -

  3. Brian

    Great tips, very helpful as I build out a GTD approach! Two follow up questions:

    Is it possible to have this behavior occur in any email folder (esp. sent items)?

    Can different flags trigger different categories while creating the task?

    .ie, if I flag it as Today, that would create a task and categorize as "Next Action", but if flagged as Tomorrow, it would categorize "Waiting For"

  4. Brian

    All folders now working. Not sure what to do with IF stmts. I'm not a VBA programmer, just an overzealous end user, so sort of faking my way through this.

    I adjusted the following lines. but it failed in a different way than I expected ("end with without with"),

    With Item
    If Item.FlagStatus = Today Then
    .ClearTaskFlag
    .Categories = ".NEXT ACTION"
    .Save
    End With

    Where would these if stmts need to go within the code, does it matter?

  5. Brian

    Spinning my wheels a bit here. Below is the entire code I am working with in Outlook 2007.

    Desired State: Clicking the followup flag in an email in any folder triggers a task with the original email attached in the task body, but does NOT paste the message body into the task body. Depending on which flag is clicked (Today, Tomorrow, etc.), the resulting task should be categorized as NEXTACTION, WAITINGFOR, etc.. The original email should be categorized as PROCESSED when the routine is done.

    Current state: clicking the followup flag correctly creates a task with the orig email attached in the task body, and does not paste the email body into the task body. However, while the email looks correct by the subject line that appears under the envelop icon in the task body, opening it just brings up a blank "new message" without any info in the subject line. The task is not categorized at all. The original email is correctly categorized as PROCESSED.

    Other notes: I am not sure I am using the correct variables for FlagStatus ("Today" versus "1"?) Can't find any listing of what those options would be. Also, some of this code is taken from your other posting about triggering tasks with rules, but the ItemChange method seems to require different methods

    Public WithEvents OlItems As Outlook.Items
    Public Sub Initialize_handler()
    Set OlItems = Application.ActiveExplorer.CurrentFolder.Items

    End Sub
    Private Sub OlItems_ItemChange(ByVal Item As Object)

    If Item.IsMarkedAsTask = True Then
    Dim Ns As Outlook.NameSpace
    Dim olTask As Outlook.TaskItem
    Set Ns = Application.GetNamespace("MAPI")
    Set olTask = Ns.GetDefaultFolder(olFolderCalendar) _
    .Items.Add(olTaskItem)
    With olTask
    .Subject = Item.Subject
    Dim newAttachment As Outlook.Attachment
    .DueDate = Now + 3
    If Item.FlagStatus = 1 Then
    .ClearTaskFlag
    .Categories = ".NEXT ACTION"
    .Save
    End If

    Set newAttachment = olTask.Attachments.Add(Item, Outlook.OlAttachmentType.olEmbeddeditem)
    .Save
    .Display
    End With
    With Item
    .ClearTaskFlag
    .Categories = "PROCESSED"
    .Save
    End With
    Set Ns = Nothing
    End If

    End Sub

  6. Brian

    If it makes it any easier I don;t need the flag to dictate the due date, I'm fine with the +3 that comes from the script. I was just trying to reassign the flag choices that were already there because I don't use to-do flags

  7. Donald Terrell

    Hi Diane,
    Still Have a bit of an issue.. I have created a user form - and placed 2 combo boxes in it - here is the code :

    Private Sub ComboBox1_Insert()

    End Sub

    Private Sub ComboBox2_Change()

    End Sub

    Private Sub CommandButton1_Click()
    lstNo = ComboBox1.ListIndex
    Unload Me
    End Sub

    Private Sub UserForm_initialize()
    With ComboBox1
    .AddItem "#Category Maintenance"
    .AddItem "#Category End User Support"
    .AddItem "#Category Hardware"

    End With
    End Sub
    Private Sub CommandButton2_Click()
    lstNo = ComboBox2.ListIndex
    Unload Me
    End Sub

    With ComboBox2
    .AddItem "#Add 5m"
    .AddItem "#Add 10m"
    .AddItem "#Add 30m"

    End With
    End Sub
    Here is my module 1:

    Public lstNo1 As Long
    Public lstNo2 As Long

    Sub HelpdeskNewTicket()
    Dim helpdeskaddress As String
    Dim objMail As Outlook.MailItem
    Dim strbody As String
    Dim oldmsg As String
    Dim senderaddress As String
    Dim addresstype As Integer

    ' Set this variable as your helpdesk e-mail address
    helpdeskaddress = "it@jaxbchfl.net"

    Set objItem = GetCurrentItem()
    Set objMail = objItem.Forward

    ' Sender E=mail Address
    senderaddress = objItem.SenderEmailAddress

    'Searches for @ in the email address to determine if it is an exchange user
    addresstype = InStr(senderaddress, "@")

    ' If the address is an Exchange DN use the Senders Name
    If addresstype = 0 Then
    senderaddress = objItem.SenderName
    End If

    'adds the senders e-mail address as the created by object for the ticket and appends the message body
    strbody = "#created by" & senderaddress & vbNewLine & "#assign Donald Terrell" & vbNewLine & "#mute on" & vbNewLine & "#close " & vbNewLine & vbNewLine & objItem.Body

    objMail.To = helpdeskaddress
    objMail.Subject = objItem.Subject
    objMail.BodyFormat = 1 'olFormatPlain'
    objMail.Body = strbody

    ' remove the comment from below to display the message before sending
    'objMail.Display

    'Automatically Send the ticket
    objMail.Display

    UserForm1.Show
    Select Case lstNo1
    Case -1 'default if not selection
    oCategory.AddItem = "1"
    Case 0
    oCategory.AddItem "#Category Maintenance"
    Case 1
    oCategory.AddItem "#Category End User Support"
    Case 2
    oCategory.AddItem "#Category Hardware"
    End Select

    UserForm2.Show
    Select Case lstNo2
    Case -1 'default if not selection
    Case 0
    oTime.AddItem "#Add 5m"
    Case 1
    oTime.AddItem "#Add 10m"
    Case 2
    oTime.AddItem "#Add 30m"
    End Select

    Set objItem = Nothing
    Set objMail = Nothing
    End Sub

    Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application
    Set objApp = Application
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
    Case "Explorer"
    Set GetCurrentItem = _
    objApp.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
    Set GetCurrentItem = _
    objApp.ActiveInspector.CurrentItem
    Case Else
    End Select
    End Function
    it partially works , I can only get 1 drop down with a listing the other does not.. so what I am trying to do is via the drop dons is to insert, based on the selected drop - Time or Category and place in the e-mail body - in certain places : behind the #assign Donald Terrell : strbody = "#created by" & senderaddress & vbNewLine & "#assign Donald Terrell" & vbNewLine & "#mute on" & vbNewLine & "#close " & vbNewLine & vbNewLine & objItem.Body
    then send... if by any chance you can contact me directly would be most appreciated..

    Donald
    dfterrell@comcast.net

  8. Donald Terrell

    Hi Diane,
    i am almost there, one thing I am not is a VBA... I have the combo coming up - and it displays all my selections, but it will not insert the selections into the body of the e-mail... here is the code:
    Private Sub ComboBox1_Change()

    End Sub
    (the above lines keep getting inserted into the code ) ??
    Private Sub CommandButton1_Click()
    lstNo = ComboBox1.ListIndex
    lstNo2 = ComboBox2.ListIndex
    Unload Me
    End Sub
    Private Sub UserForm_initialize()
    With ComboBox1
    .AddItem "#Category Maintenance"
    .AddItem "#Category End User Support"
    .AddItem "#Category Hardware"
    .AddItem "#Category Software"
    .AddItem "#Category iSeries"
    .AddItem "#Category Administrative"
    .AddItem "#Category EIS"
    .AddItem "#Category Other"
    .AddItem "#Category Network"
    .AddItem "#Category E-Mail"
    .AddItem "#Category Firewall"
    .AddItem "#Category Security"
    .AddItem "#Category Switches"
    .AddItem "#Category SAN"
    .AddItem "#Category UPS"
    .AddItem "#Category GIS"
    .AddItem "#Category Web"

    End With

    lstNo = ComboBox2.ListIndex

    With ComboBox2
    .AddItem "#Add 5m"
    .AddItem "#Add 10m"
    .AddItem "#Add 30m"
    .AddItem "#Add 1hr"
    .AddItem "#Add 2hr"
    .AddItem "#Add 4hr"
    .AddItem "#Add 6hr"
    .AddItem "#Add 8hr"
    .AddItem "#Add 10hr"
    .AddItem "#Add 12hr"
    .AddItem "#Add 1days"
    .AddItem "#Add 2days"
    .AddItem "#Add 3days"
    .AddItem "#Add 5Days"
    .AddItem "#Add 1weeks"
    .AddItem "#Add 2weeks"
    .AddItem "#Add 1month"

    End With
    End Sub

    Here is the module code:
    Public lstNo1 As Long
    Public lstNo2 As Long

    Sub HelpdeskNewTicket()
    Dim helpdeskaddress As String
    Dim objMail As Outlook.MailItem
    Dim strbody As String
    Dim oldmsg As String
    Dim senderaddress As String
    Dim addresstype As Integer

    ' Set this variable as your helpdesk e-mail address
    helpdeskaddress = "it@jaxbchfl.net"

    Set objItem = GetCurrentItem()
    Set objMail = objItem.Forward

    ' Sender E=mail Address
    senderaddress = objItem.SenderEmailAddress

    'Searches for @ in the email address to determine if it is an exchange user
    addresstype = InStr(senderaddress, "@")

    ' If the address is an Exchange DN use the Senders Name
    If addresstype = 0 Then
    senderaddress = objItem.SenderName
    End If

    'adds the senders e-mail address as the created by object for the ticket and appends the message body
    strbody = "#created by" & senderaddress & vbNewLine & "#assign Donald Terrell" & vbNewLine & "#mute on" & vbNewLine & "#close " & vbNewLine & vbNewLine & objItem.Body

    objMail.To = helpdeskaddress
    objMail.Subject = objItem.Subject
    objMail.BodyFormat = 1 'olFormatPlain'
    objMail.Body = strbody

    ' remove the comment from below to display the message before sending
    'objMail.Display

    'Automatically Send the ticket
    objMail.Display

    UserForm1.Show
    Select Case lstNo1
    Case -1 'default if not selection
    oCategory.AddItem = "1"

    Case 0
    oAddItem = "#Category Maintenance"
    Case 1
    oCategory.AddItem "#Category End User Support"
    Case 2
    oCategory.AddItem "#Category Hardware"
    Case 3
    oCategory.AddItem "#Category Software"
    Case 4
    oCategory.AddItem "#Category iSeries"
    Case 5
    oCategory.AddItem "#Category Administrative"
    Case 6
    oCategory.AddItem "#Category EIS"
    Case 7
    oCategory.AddItem "#Category Other"
    Case 8
    oCategory.AddItem "#Category Network"
    Case 9
    oCategory.AddItem "#Category E-Mail"
    Case 10
    oCategory.AddItem "#Category Firewall"
    Case 11
    oCategory.AddItem "#Category Security"
    Case 12
    oCategory.AddItem "#Category Switches"
    Case 13
    oCategory.AddItem "#Category SAN"
    Case 14
    oCategory.AddItem "#Category UPS"
    Case 15
    oCategory.AddItem "#Category GIS"
    Case 16
    oCategory.AddItem "#Category Web"
    End Select

    'UserForm2.Show
    Select Case lstNo2
    Case -1 'default if not selection

    Case 0
    oAddItem = "#Add 5m"
    Case 1
    oAddItem = "#Add 10m"
    Case 2
    oAddItem = "#Add 30m"
    Case 3
    oTime.AddItem "#Add 1hr"
    Case 4
    oTime.AddItem "#Add 2hr"
    Case 5
    oTime.AddItem "#Add 4hr"
    Case 6
    oTime.AddItem "#Add 6hr"
    Case 7
    oAddItem = "#Add 8hr"
    Case 8
    oTime.AddItem "#Add 10hr"
    Case 9
    oTime.AddItem "#Add 12hr"
    Case 10
    oTime.AddItem "#Add 1days"
    Case 11
    oTime.AddItem "#Add 2days"
    Case 12
    oTime.AddItem "#Add 3days"
    Case 13
    oTime.AddItem "#Add 5Days"
    Case 14
    oTime.AddItem "#Add 1weeks"
    Case 15
    oTime.AddItem "#Add 2weeks"
    Case 16
    oTime.AddItem "#Add 1month"
    End Select

    Set objItem = Nothing
    Set objMail = Nothing
    End Sub

    Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application
    Set objApp = Application
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
    Case "Explorer"
    Set GetCurrentItem = _
    objApp.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
    Set GetCurrentItem = _
    objApp.ActiveInspector.CurrentItem
    Case Else
    End Select
    End Function

    what am i missing to insert hwat ever I select in the combo box ??

    Donald

  9. Donald Terrell

    Diane.. It is working - but fro some reason - after I save and close out of outlook and try to submit a Ticket - it only places the top 2 lines in my combo box : #category Maintenance
    #add 5m
    here is the code I have in place:
    Macro :

    Public lstNo1 As Long
    Public lstNo2 As Long

    Sub HelpdeskNewTicket()
    Dim helpdeskaddress As String
    Dim objMail As Outlook.MailItem
    Dim strbody As String
    Dim oldmsg As String
    Dim senderaddress As String
    Dim addresstype As Integer

    ' Set this variable as your helpdesk e-mail address
    helpdeskaddress = "it@jaxbchfl.net"

    Set objItem = GetCurrentItem()
    Set objMail = objItem.Forward

    ' Sender E=mail Address
    senderaddress = objItem.SenderEmailAddress

    'Searches for @ in the email address to determine if it is an exchange user
    addresstype = InStr(senderaddress, "@")

    ' If the address is an Exchange DN use the Senders Name
    If addresstype = 0 Then
    senderaddress = objItem.SenderName
    End If

    UserForm1.Show
    Select Case lstNo1
    Case 0
    strCategory = "#category Maintenance"
    Case 1
    strCategory = "#category End User Support"
    Case 2
    strCategory = "#category Hardware"
    Case 3
    strCategory = "#category Software"
    Case 4
    strCategory = "#category iSeries"
    Case 5
    strCategory = "#category Administrative"
    Case 6
    strCategory = "#category EIS"
    Case 7
    strCategory = "#category Other"
    Case 8
    strCategory = "#category Network"
    Case 9
    strCategory = "#category E-Mail"
    Case 10
    strCategory = "#category Firewall"
    Case 11
    strCategory = "#category Security"
    Case 12
    strCategory = "#category Switches"
    Case 13
    strCategory = "#category SAN"
    Case 14
    strCategory = "#category UPS"
    Case 15
    strCategory = "#category GIS"
    Case 16
    strCategory = "#category Web"
    End Select

    'UserForm2.Show
    Select Case lstNo2
    Case 0
    strTime = "#add 5m"
    Case 1
    strTime = "#add 10m"
    Case 2
    strTime = "#add 30m"
    Case 3
    strTime = "#add 1hr"
    Case 4
    strTime = "#add 2hr"
    Case 5
    strTime = "#add 4hr"
    Case 6
    strTime = "#add 6hr"
    Case 7
    strItem = "#add 8hr"
    Case 8
    strTime = "#add 10hr"
    Case 9
    strTime = "#add 12hr"
    Case 10
    strTime = "#add 1day"
    Case 11
    strTime = "#add 2day"
    Case 12
    strTime = "#add 3day"
    Case 13
    strTime = "#add 5Day"
    Case 14
    strTime = "#add 1week"
    Case 15
    strTime = "#add 2week"
    Case 16
    strTime = "#add 1month"
    End Select

    'adds the senders e-mail address as the created by object for the ticket and appends the message body
    strbody = "#created by " & senderaddress & vbNewLine & "#assign Donald Terrell" & vbNewLine & strCategory & vbNewLine & strTime & vbNewLine & "#mute on" & vbNewLine & "#close " & vbNewLine & vbNewLine & objItem.Body

    objMail.To = helpdeskaddress
    objMail.Subject = objItem.Subject
    objMail.BodyFormat = 1 'olFormatPlain'
    objMail.Body = strbody

    ' remove the comment from below to display the message before sending
    'objMail.Display

    'Automatically Send the ticket
    objMail.Display

    Set objItem = Nothing
    Set objMail = Nothing
    End Sub

    Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application
    Set objApp = Application
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
    Case "Explorer"
    Set GetCurrentItem = _
    objApp.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
    Set GetCurrentItem = _
    objApp.ActiveInspector.CurrentItem
    Case Else
    End Select
    End Function

    Combo Box:

    Private Sub ComboBox1_Change()

    End Sub

    Private Sub CommandButton1_Click()
    Unload Me
    End Sub

    Private Sub UserForm_initialize()
    With ComboBox1
    .AddItem "#category Maintenance"
    .AddItem "#category End User Support"
    .AddItem "#category Hardware"
    .AddItem "#category Software"
    .AddItem "#category iSeries"
    .AddItem "#category Administrative"
    .AddItem "#category EIS"
    .AddItem "#category Other"
    .AddItem "#category Network"
    .AddItem "#category E-Mail"
    .AddItem "#category Firewall"
    .AddItem "#category Security"
    .AddItem "#category Switches"
    .AddItem "#category SAN"
    .AddItem "#category UPS"
    .AddItem "#category GIS"
    .AddItem "#category Web"

    End With

    With ComboBox2
    .AddItem "#add 5m"
    .AddItem "#add 10m"
    .AddItem "#add 30m"
    .AddItem "#add 1hr"
    .AddItem "#add 2hr"
    .AddItem "#add 4hr"
    .AddItem "#add 6hr"
    .AddItem "#add 8hr"
    .AddItem "#add 10hr"
    .AddItem "#add 12hr"
    .AddItem "#add 1day"
    .AddItem "#add 2day"
    .AddItem "#add 3day"
    .AddItem "#add 5Day"
    .AddItem "#add 1week"
    .AddItem "#add 2week"
    .AddItem "#add 1month"

    End With
    End Sub

    what am I missing?????
    Donald

  10. Donald Terrell

    WOW!!! now I have the Time being added in like it is supposed to - but when i select a Category, it stays at Maintenance ???

  11. Donald Terrell

    Diane,
    I want to Thank You!!!! for all your Help!!!! The Macro and Form are working like a Charm!!! do you want me to post the Final code for both?
    I have even added additional items to the form, this cuts down ALLOT of time entering IT related service Tickets...
    One final thing.. It would be really advantageous to also have the ability to select the macro (which i have as an icon in Outlook) to generate a New Ticket if need be, selecting all the features needed for the ticket and just hit send....
    SpiceWorks is very slow and cumbersome.. this works 100% faster with much less effort and is tuned to my needs.. I am at a point which I generate an e-mail to my self, select the macro, fill in what i need to have in it and send..

    Thanks Again!!!!
    Donald

  12. Donald Terrell

    Diane,
    I sent you the macro and form code to your slapstick account...

    Thanks Again for all the Help!!!!!!

    Donald

  13. Russ B.

    I am using the create a task from email script and it is working amazing. Now once the task is complete I need outlook to see that and send an email. I have cobbled together the following code but it does not seem to be working... Meaning when I mark complete in the task it doesn't seem to trigger. I have been looking at your various examples for triggering a script when changing a flag. I think I am missing something... Any help would be much appreciated. I have placed the following code in 'ThisOutlookSession'

    Sub Item_PropertyChange(ByVal Name)
    Set oMsg = Application.CreateItem(olMailItem)
    Set objControl = objPage.Controls("TextBox1")
    Set objPage = Item.GetInspector.ModifiedFormPages

    Set objControl = objPage.Controls("TextBox1")
    MyValue = objControl.Value

    If Item.Status = olTaskComplete And Item.IsRecurring = False Then
    If Item.PercentComplete = 100 Then

    With oMsg
    .Recipients.Add (MyValue)

    .Subject = "Task Completed "
    .Body = Item.Subject
    .Display
    End With

    End If
    End If
    End Sub

Leave a Reply

If the Post Coment button disappears, press your Tab key.