
Converting mail items to task (outlook2002)
I am new to outlook and vba. I'm trying to write some code to convert
new mail items in an inbox to tasks in a task folder.
I have written some code to create a task which I have tested as a
stand alone module. I am not sure about calling modules and passing
parameters in
VBA though.
I assume I will have to write some code which fires on the
Application.newmail event, reads the subject and body of the mail and
calls the create_task module with these parameters.
Sub create_task(Subject As String, Body As String)
MsgBox ("create_task")
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
Set myItem = myOlApp.CreateItem(olTaskItem)
myItem.Subject = Subject
myItem.Body = Body
myItem.Save
End Sub
Can anybody offer any help?
Thanks,
-Andrew