Sending information from a cell in excel to a task in outlook

P

Pasty

Hi there I have code (at bottom of message) which allows me to create a task
in my outlook account and it is all working perfectly. How do I tweak it so
a) it puts the body as the action outstanding (situated in column u)
b) it sends the task if there is a month until the action needs to be
completed as a reminder (due dates for actions are in column v)
c) it goes down the list and checks each ones action due date (if they have
one) to see if it a task is required
d) it assigns them to other peoples e-mail accounts (all the relevant names
are situated in column C which tie up with their e-mail names)


Sub Create_Task_and_email_it_to_recipient()
Dim olApp As Outlook.Application
Dim olTask As Outlook.TaskItem
Dim Subject As String
Dim Body As String

Dim wbBook As Workbook
Dim wsMain As Worksheet

Set wbBook = ThisWorkbook
Set wsMain = wbBook.Worksheets("Risk By Function")

With wsMain
Subject = "Non-Financial Risk Actions due"
Body = .Cells(4, 3).Value
End With

On Error GoTo Error_Handling
Set olApp = GetObject(, "Outlook.Application")
Set olTask = olApp.CreateItem(3)

Application.ScreenUpdating = False

With olTask
..Subject = Subject
..Body = Body
..Save
End With


Application.ScreenUpdating = True

MsgBox "The task added into Outlook Tasklist and addressed by email to
Recipient successfully.", vbInformation

Exit_Here:
Set olTask = Nothing
Set olApp = Nothing
Exit Sub

Error_Handling:
If Err.Number = 429 And olApp Is Nothing Then
Set olApp = CreateObject("Outlook.Application")
Resume Next
Else
MsgBox "Error No: " & Err.Number & "; Description: "
Resume Exit_Here
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top