Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default sending outlook tasks to multiple people

I have written this bit of code that goes through a worksheet, and
sends line items to Outlook recipients as tasks. I now it's probably
not the best piece of code, but it works. Now I need to be able to
send the same task to multiple users, their user ID's would be in the
same cell, and separated by a comma or something. I'm not exactly sure
how to make this happen. Here is my code, if anyone has any
suggestions, they would be appreciated. Here is the code:

Dim olApp As Outlook.Application
Dim olTsk As TaskItem
Dim olDelegate As Outlook.Recipient
Dim cell As Range

'start for loop to begin sending tasks
For Each cell In Range("B8", Range("B8").End(xlDown)).Cells

Set olApp = New Outlook.Application
Set olTsk = olApp.CreateItem(olTaskItem)

'if task has been sent skip
If cell.Offset(0, 8).Value = "X" Then GoTo exitearly
If cell.Offset(0, 8).Value = "x" Then GoTo exitearly

'set recipient of task
Set olDelegate = olTsk.Recipients.Add(cell.Offset(0, 7).Value)

olDelegate.Resolve

'if recipient is valid create task
If olDelegate.Resolved Then
With olTsk
.Subject = cell.Offset(0, 0).Value
.Body = cell.Offset(0, 1).Value
.Status = olTaskNotStarted
.Importance = olImportanceHigh
.StartDate = cell.Offset(0, 3).Value
.DueDate = cell.Offset(0, 4).Value
.TotalWork = 40
.ActualWork = 20
.Assign
.Send
End With
Else
'if recipient is not valid display error
MsgBox (cell.Offset(0, 7).Value & " is not a valid user on
this system.")
GoTo exitearly
End If
'mark task sent when sent
cell.Offset(0, 8).Value = "X"

exitearly: 'goto point to escape loop

Set olTsk = Nothing
Set olApp = Nothing

Next cell

Set olTsk = Nothing
Set olApp = Nothing

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
Using Outlook Tasks from Excel... Devon Excel Discussion (Misc queries) 0 March 5th 09 04:51 PM
Exporting from Outlook Tasks to excel Chris_john Turner Excel Programming 0 September 14th 05 12:12 PM
Outlook Tasks assigned from Excel? Don Rouse Excel Programming 0 March 30th 05 09:15 PM
Outlook Automation, Deleting Tasks jjjustinnn Excel Programming 3 January 17th 04 07:11 PM


All times are GMT +1. The time now is 01:26 AM.

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

About Us

"It's about Microsoft Excel"