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:
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.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. 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


Reply With Quote
