Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default export to outlook task list...

I'm creating a journaling utility for my coworkers. I need a macro
that takes the contents of a cell and exports as a new task in
Outlook. Specifically...

....a subject is entered into A1 (Deliver plans to consultant)
....a due date is entered into B1 (6/20/2007)
....a macro takes the contents of A1 and B1 and creates a Task in
Outlook so that when Outlook Task list is brought up, the task is
there.

I know just about anything is possible with Excel VBA. Can anyone
help me?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default export to outlook task list...

I'm making the assumption that your list continues down columns A and B for
a set of tasks rather than just looking at row 1.

_____________________________________

Sub LoadTasks()

Const olFolderTasks = 13

Dim r As Integer
Dim x As Integer

r = Range("A65536").End(xlUp).Row

Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set olFolder = ns.GetDefaultFolder(olFolderTasks)

For x = 1 To r
Set taskItem = olFolder.Items.Add
With taskItem
.Subject = Sheets("Sheet1").Cells(x, 1).Value
.DueDate = Sheets("Sheet1").Cells(x, 2).Value
.Save
End With
Next x

Set taskItem = Nothing
Set ns = Nothing
Set ol = Nothing

End Sub

______________________________________

Steve Yandl
wrote in message
ups.com...
I'm creating a journaling utility for my coworkers. I need a macro
that takes the contents of a cell and exports as a new task in
Outlook. Specifically...

...a subject is entered into A1 (Deliver plans to consultant)
...a due date is entered into B1 (6/20/2007)
...a macro takes the contents of A1 and B1 and creates a Task in
Outlook so that when Outlook Task list is brought up, the task is
there.

I know just about anything is possible with Excel VBA. Can anyone
help me?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default export to outlook task list...

On Jun 14, 3:56 pm, "Steve Yandl" wrote:
I'm making the assumption that your list continues down columns A and B for
a set of tasks rather than just looking at row 1.

_____________________________________

Sub LoadTasks()

Const olFolderTasks = 13

Dim r As Integer
Dim x As Integer

r = Range("A65536").End(xlUp).Row

Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set olFolder = ns.GetDefaultFolder(olFolderTasks)

For x = 1 To r
Set taskItem = olFolder.Items.Add
With taskItem
.Subject = Sheets("Sheet1").Cells(x, 1).Value
.DueDate = Sheets("Sheet1").Cells(x, 2).Value
.Save
End With
Next x

Set taskItem = Nothing
Set ns = Nothing
Set ol = Nothing

End Sub

______________________________________


I got a "Assignment to Constant not permitted" error for *Set olFolder
= ns.GetDefaultFolder(olFolderTasks)* What does that mean?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default export to outlook task list...

Can anyone help with this? I tried the "Option Explicit" with this
and using the code suggested in this thread, I set the ol, ns, and
olFolder As Object and set TaskItem as a Variant. I'm still getting
errors.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default export to outlook task list...

Try deleting the line
Const olFolderTasks = 13
and then changing the line
Set olFolder = ns.GetDefaultFolder(olFolderTasks)
to read
Set olFolder = ns.GetDefaultFolder(13)

It worked fine when I tested it. An alternate approach would be to set a
reference to Outlook under 'Tools References' and alter the way the
Outlook objects are created.

Steve


wrote in message
ups.com...
Can anyone help with this? I tried the "Option Explicit" with this
and using the code suggested in this thread, I set the ol, ns, and
olFolder As Object and set TaskItem as a Variant. I'm still getting
errors.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
export Exel task list into Project 2002? TechoPM Excel Discussion (Misc queries) 1 January 15th 09 10:46 PM
sync between table in excel to task list in outlook ayelet Excel Discussion (Misc queries) 0 August 31st 08 06:19 AM
Set Up to Export Excel group list to Outlook Express Leanne Excel Discussion (Misc queries) 1 November 23rd 07 08:43 AM
List Outlook tasks from another person's shared task list Notawahoo Excel Programming 0 January 10th 07 06:16 PM
loop trough e-mail address list to send task lists with outlook Paul. Excel Discussion (Misc queries) 2 April 14th 05 11:48 AM


All times are GMT +1. The time now is 07:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"