Results 1 to 2 of 2

Thread: [RESOLVED] Outlook : Selected mailitem.body property

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Location
    South Africa
    Posts
    32

    Resolved [RESOLVED] Outlook : Selected mailitem.body property

    The purpose of the code is to create a new task with the currently selected mailitem's body as the body of the new taks. In other words : Create a copy of a message as a Task form.

    My problem: Don't know how to use the selected message handle. I run this from a custom toolbar button created in the normal outlook explorer window and in the message opened window.

    My code:

    Code:
    Sub DisplayForm()
    Set myMailFolder = Session.GetDefaultFolder(olFolderInbox)
    Set myMailItem = myMailFolder.Items(2)
    Set myTaskFolder = Session.GetDefaultFolder(olFolderTasks)
    Set myItem = myTaskFolder.Items.Add("IPM.Task")
        
        With myItem
            .Subject = myMailItem.Subject
            .Body = myMailItem.Body
       End With
       myItem.Display
    End Sub
    As you can see, at the moment the body text of mailitem (2) is copied and not which ever one the user has selected at the time.

    Ps. The 3rd party exchange server I use does not support custom tasks, so I have to do this with code, can't use the more conventional custom actions function in design form.

    Thanks

  2. #2

Posting Permissions

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



Click Here to Expand Forum to Full Width