Results 1 to 2 of 2

Thread: [RESOLVED] [Outlook] Selected Message Item

  1. #1

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

    Resolved [RESOLVED] [Outlook] Selected Message Item

    The purpose of the code is to create a copy of the selected message as a task form.

    The problem: I don't now how to use the selected message property. At the moment I copy the body of a specified message item (Item (2) in the example below) and not the message selected by the user at the time.

    This code is run from a custom button on the toolbar of the main outlook explorer window and the opened message 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
    Ps. Our exchange mail server is 3rd pary software and does not support custom forms. The custom actions on the design forms function does therefore not work. I have to do it in vbscript.

    Thanks.

  2. #2

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

    Re: [Outlook] Selected Message Item

    I hae managed to resolve the issue. For the benefit of others that might search this thread in trouble shooting, I've posted the code below:

    Code:
    Set myTaskFolder = Session.GetDefaultFolder(olFolderTasks)
    Set myOlSel = Application.ActiveExplorer.Selection
     For x = 1 To myOlSel.Count
        Set myparentitem = myOlSel.Item(x)
            NewTask myparentitem
     Next x
    NewTask is a subroutine that creates a task with the the same subject and body as the "parent item", which is a mailitem in this case.

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