Create a Task with VB Script

  • Thread starter Thread starter S. Sarman
  • Start date Start date
S

S. Sarman

Hello NG

I am trying to create a task from an own mad message form in VB Script.

Under VBA I used following code:

Sub CreateTaskFromMail()
Dim myTask As TaskItem
Dim myFolder As Folders
Dim myNameSpace As NameSpace

Set myNameSpace = Application.GetNamespace("MAPI")
Set myTask = Application.CreateItem(olTaskItem)
myTask.Subject = ActiveInspector.CurrentItem.Subject
myTask.Body = ActiveInspector.CurrentItem.Body
myTask.Categories = "Mitteilung"
myTask.Importance = ActiveInspector.CurrentItem.Importance
myTask.DueDate = Now()
myTask.StartDate = Now()
myTask.Save
Set myTask = Nothing
End Sub

Under VB Script this code doesn't run. What's wrong? Can anybody help me?

Thanks
Sandor
 
VBScript where? VBScript doesn't support typed variable declarations (e.g.
"As TaskItem") or Outlook constants (olTaskItem). You'll need to declare
constants or use their literal values.
 
Back
Top