How do you create a task using VBA??? 
Author Message
 How do you create a task using VBA???

Does anyone have a sample code to create a TASK in Outlook
2000 using VBA with the following parameters:

Create task
Add document as attachment
Add recipients
Date of task, recurrence
Subject
text

Thanks in advance

Dominic



Sun, 29 Aug 2004 06:34:43 GMT  
 How do you create a task using VBA???
Dominic, not everything you want but should help you out

    'set the object variables
    Dim Folder As MAPIFolder
    Dim Task As TaskItem
    Set Task = Application.CreateItem(olTaskItem)

    'set the subject/body/dates/importance
    Task.Subject = txt_subject
    Task.Body = txt_body
    Task.StartDate = txt_start_date
    Task.DueDate = txt_end_date

    'we cannot assign the priory directly, must provide it in a certain
format
    'this takes the text input and converts it into the correct format
    Select Case cb_priority
        Case Is = "Low"
            Task.Importance = olImportanceLow
        Case Is = "Normal"
            Task.Importance = olImportanceNormal
        Case Is = "High"
            Task.Importance = olImportanceHigh
    End Select

    'set the recipients
    Dim lngItem As Long
    For lngItem = 0 To lst_recipients.ListCount - 1
        lst_recipients.ListIndex = lngItem
            Task.Recipients.Add lst_recipients.List(lngItem)
    Next lngItem

    Task.Assign
    Task.Recipients.ResolveAll
    Task.Send

    'release the Outlook objects
    Set Folder = Nothing
    Set Task = Nothing


Quote:
> Does anyone have a sample code to create a TASK in Outlook
> 2000 using VBA with the following parameters:

> Create task
> Add document as attachment
> Add recipients
> Date of task, recurrence
> Subject
> text

> Thanks in advance

> Dominic



Fri, 10 Sep 2004 20:37:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to create a new task using VBA?

2. Create successor reltionship among tasks using VBA ??

3. VBA - Create Outlook Profiles - Can it be done!

4. Using 'Tasks' in VBA : QUESTION

5. delete a task using vba

6. UPDATING a task using VBA

7. Copying tasks using VBA?

8. Returning The Task Outline Level value using VBA

9. Using VBA to check whether a task needs updating

10. Beginners question on how to tackle a specific task using VBA

11. VBA task insert into an existing task list?

12. Creating tasks in Outlook using VB

 

 
Powered by phpBB® Forum Software