Creating an Outlook Task from MS Word 2000 
Author Message
 Creating an Outlook Task from MS Word 2000

I would like to (as per our users request) automate task creation and
assigning tasks for a project we have on - we can't use Project 2000
unfortunately. This will be done by using information typed either into a
Word Document. So I need to be able to open Outlook and access the task
folder and create a new task and then assign it to someone else using
information stored in fields on a Word Document.

I would have a table with text fields like:

TaskSubject1    TaskResponsibility1    DueDate1

TaskSubject2    TaskResponsibility2    DueDate2

TaskSubject3    TaskResponsibility3    DueDate3

If anyone has done a similar thing I would be grateful for any assistance.



Sun, 08 Jun 2003 11:52:31 GMT  
 Creating an Outlook Task from MS Word 2000
Hi Vera,

Maybe something like:

-------------------------------------------------
Sub WriteOutlookTask()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oNewTask As Outlook.TaskItem

On Error Resume Next
  Set oOutlookApp = GetObject(, "Outlook.Application")
  If Err <> 0 Then
    Set oOutlookApp = CreateObject("Outlook.Application")
    bStarted = True
  End If
  On Error GoTo 0

  Set oNewTask = oOutlookApp.CreateItem(olTaskItem)

  With oNewTask
    .Save
    .Assign
    .Subject = "TaskSubject1"
    .Recipients.Add Name:="Name of recipient"
    .Recipients.ResolveAll
    .DueDate = #1/1/2001#
  End With

  oNewTask.Send

  If bStarted Then oOutlookApp.Quit

  Set oNewTask = Nothing
  Set oOutlookApp = Nothing

End Sub
-------------------------------------------------

Hope this helps,
regards,
Astrid

Please post replies to the newsgroup so that other readers can contribute or
benefit.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> I would like to (as per our users request) automate task creation and
> assigning tasks for a project we have on - we can't use Project 2000
> unfortunately. This will be done by using information typed either into a
> Word Document. So I need to be able to open Outlook and access the task
> folder and create a new task and then assign it to someone else using
> information stored in fields on a Word Document.

> I would have a table with text fields like:

> TaskSubject1    TaskResponsibility1    DueDate1

> TaskSubject2    TaskResponsibility2    DueDate2

> TaskSubject3    TaskResponsibility3    DueDate3

> If anyone has done a similar thing I would be grateful for any assistance.



Sun, 08 Jun 2003 20:37:55 GMT  
 Creating an Outlook Task from MS Word 2000
Thanks Astrid,

Your code is very helpful.

I now need to get the results of Word's form fields into the:

.Subject
.Recipients
.DueDate

part of the code. This will test my brain!!

Regards
Vera

| Hi Vera,
|
| Maybe something like:
|
| -------------------------------------------------
| Sub WriteOutlookTask()
| Dim bStarted As Boolean
| Dim oOutlookApp As Outlook.Application
| Dim oNewTask As Outlook.TaskItem
|
| On Error Resume Next
|   Set oOutlookApp = GetObject(, "Outlook.Application")
|   If Err <> 0 Then
|     Set oOutlookApp = CreateObject("Outlook.Application")
|     bStarted = True
|   End If
|   On Error GoTo 0
|
|   Set oNewTask = oOutlookApp.CreateItem(olTaskItem)
|
|   With oNewTask
|     .Save
|     .Assign
|     .Subject = "TaskSubject1"
|     .Recipients.Add Name:="Name of recipient"
|     .Recipients.ResolveAll
|     .DueDate = #1/1/2001#
|   End With
|
|   oNewTask.Send
|
|   If bStarted Then oOutlookApp.Quit
|
|   Set oNewTask = Nothing
|   Set oOutlookApp = Nothing
|
| End Sub
| -------------------------------------------------
|
| Hope this helps,
| regards,
| Astrid
|
| Please post replies to the newsgroup so that other readers can contribute or
| benefit.
|
| Visit the MVP Word FAQ site at http://www.mvps.org/word/
| For direct access to all Microsoft newsgroups:



Wed, 11 Jun 2003 16:27:14 GMT  
 Creating an Outlook Task from MS Word 2000
Hi Vera,

That's not so difficult:

    ActiveDocument.Formfields("NameOfFormfield").Result

will give you the entered text from the formfield.

So try something like:
    With oNewTask
        .Subject = ActiveDocument.Formfields("NameSubjectField").Result
etc.

Hope this helps,
regards,
Astrid

Please post replies to the newsgroup so that other readers can contribute or
benefit.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Thanks Astrid,

> Your code is very helpful.

> I now need to get the results of Word's form fields into the:

> .Subject
> .Recipients
> .DueDate

> part of the code. This will test my brain!!

> Regards
> Vera




- Show quoted text -

Quote:
> | Hi Vera,
> |
> | Maybe something like:
> |
> | -------------------------------------------------
> | Sub WriteOutlookTask()
> | Dim bStarted As Boolean
> | Dim oOutlookApp As Outlook.Application
> | Dim oNewTask As Outlook.TaskItem
> |
> | On Error Resume Next
> |   Set oOutlookApp = GetObject(, "Outlook.Application")
> |   If Err <> 0 Then
> |     Set oOutlookApp = CreateObject("Outlook.Application")
> |     bStarted = True
> |   End If
> |   On Error GoTo 0
> |
> |   Set oNewTask = oOutlookApp.CreateItem(olTaskItem)
> |
> |   With oNewTask
> |     .Save
> |     .Assign
> |     .Subject = "TaskSubject1"
> |     .Recipients.Add Name:="Name of recipient"
> |     .Recipients.ResolveAll
> |     .DueDate = #1/1/2001#
> |   End With
> |
> |   oNewTask.Send
> |
> |   If bStarted Then oOutlookApp.Quit
> |
> |   Set oNewTask = Nothing
> |   Set oOutlookApp = Nothing
> |
> | End Sub
> | -------------------------------------------------
> |
> | Hope this helps,
> | regards,
> | Astrid
> |
> | Please post replies to the newsgroup so that other readers can
contribute or
> | benefit.
> |
> | Visit the MVP Word FAQ site at http://www.mvps.org/word/
> | For direct access to all Microsoft newsgroups:




Sun, 15 Jun 2003 08:49:22 GMT  
 Creating an Outlook Task from MS Word 2000
Thank you Astrid, I really appreciate your help with this. It works great
now. I was getting myself all confused.

I just have one more query re this subject.

I have a table with columns that have the form fields I would like to
populate new tasks with, ie.

Table Heading:
Action Item    Responsibility            Due Date             Status
New row:
TaskItem1    TaskResponsibility1    TaskDueDate1
New row:
TaskItem2    TaskResponsibility2    TaskDueDate2
New row:
TaskItem3    TaskResponsibilty3    TaskDueDate3

and this goes on to form fields task* 15. Each row in the table would give
me the info I need to fill in a task form. So in theory I could end up with
15 tasks or only 5.

I can get the first row's info into a task with the code you have kindly
given me as below:
With oNewTask
            .Assign
            .Subject = ActiveDocument.FormFields("TaskItem1").Result
            .Recipients.Add
Name:=ActiveDocument.FormFields("TaskResponsibility1").Result
            .Recipients.ResolveAll
            .DueDate = ActiveDocument.FormFields("TaskDateDue1").Result
          End With

But I am not sure of the best way to go about getting new tasks for each
row. I could create code 15 times to capture each rows info and create 15
tasks. But I do not want to create a task if the result of any "TaskItem*"
form field is blank.

Can I count Form Fields and say If  any "TaskItem" form field is blank go to
next "Task Item" form field? Or can you GoTo rows and then run a macro to
see if the "Task Item" form field is blank and if it is GoTo next row.

Any thoughts? I hope this makes sense.

Regards
Vera Hawkins


Quote:
> Hi Vera,

> That's not so difficult:

>     ActiveDocument.Formfields("NameOfFormfield").Result

> will give you the entered text from the formfield.

> So try something like:
>     With oNewTask
>         .Subject = ActiveDocument.Formfields("NameSubjectField").Result
> etc.

> Hope this helps,
> regards,
> Astrid

> Please post replies to the newsgroup so that other readers can contribute
or
> benefit.

> Visit the MVP Word FAQ site at http://www.mvps.org/word/
> For direct access to all Microsoft newsgroups:



> > Thanks Astrid,

> > Your code is very helpful.

> > I now need to get the results of Word's form fields into the:

> > .Subject
> > .Recipients
> > .DueDate

> > part of the code. This will test my brain!!

> > Regards
> > Vera



Mon, 16 Jun 2003 09:53:04 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Final answer: Creating an Outlook Task from MS Word 2000

2. Repost: Creating an Outlook Task from MS Word 2000

3. Find Tasks created from MS Project 2000 in Outlook 2000

4. Calling MS-Word from button event click on outlook 98/2000

5. Linking Access 2000 Table to Outlook 2000 Tasks

6. Create task's in MS Outlook from VB4.0 application

7. Create task's in MS Outlook from VB4.0 application

8. Question regarding MAPI, MS Outlook 2000, and Outlook Express 6

9. MS PJ 2000 and MS Word via VBA

10. Outlook 2000 to Word 2000 document merge problem

11. Problem with Tasks and localized Outlook 2000

12. how to send a task to someone else in outlook 2000

 

 
Powered by phpBB® Forum Software