ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Send a task from an excel file (https://www.excelbanter.com/excel-programming/294001-send-task-excel-file.html)

Lorna

Send a task from an excel file
 
How can I send a task (outlook) from an excel file.
Also this task must contain some information from this
excel file (some cells).

And after the recipient has finished the task, outlook
must the filled the excel file with some data.

Thanks



Rob van Gelder[_4_]

Send a task from an excel file
 
This request is better asked in an Outlook Newsgroup. I'm pretty horrible at
Outlook automation, so it would be a good idea to get this verified.


Sub test()
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTask As Outlook.TaskItem

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo 0

If Not objApp Is Nothing Then
Set objNS = objApp.GetNamespace("MAPI")
objNS.Logon

Set objTask = objApp.CreateItem(olTaskItem)
objTask.Subject = Range("A1").Value
objTask.DueDate = Range("B1").Value
objTask.Save

Set objTask = Nothing
Set objApp = Nothing
End If
End Sub



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Lorna" wrote in message
...
How can I send a task (outlook) from an excel file.
Also this task must contain some information from this
excel file (some cells).

And after the recipient has finished the task, outlook
must the filled the excel file with some data.

Thanks





Rob van Gelder[_4_]

Send a task from an excel file
 
Sorry. Meant this to be late binding.

First 3 lines should read:

Dim objApp As Object
Dim objNS As Object
Dim objTask As Object

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob van Gelder" wrote in message
...
This request is better asked in an Outlook Newsgroup. I'm pretty horrible

at
Outlook automation, so it would be a good idea to get this verified.


Sub test()
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTask As Outlook.TaskItem

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo 0

If Not objApp Is Nothing Then
Set objNS = objApp.GetNamespace("MAPI")
objNS.Logon

Set objTask = objApp.CreateItem(olTaskItem)
objTask.Subject = Range("A1").Value
objTask.DueDate = Range("B1").Value
objTask.Save

Set objTask = Nothing
Set objApp = Nothing
End If
End Sub



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Lorna" wrote in message
...
How can I send a task (outlook) from an excel file.
Also this task must contain some information from this
excel file (some cells).

And after the recipient has finished the task, outlook
must the filled the excel file with some data.

Thanks







Lorna

Send a task from an excel file
 
Thank you very much.

I will try it right now!

Lorna

-----Original Message-----
Sorry. Meant this to be late binding.

First 3 lines should read:

Dim objApp As Object
Dim objNS As Object
Dim objTask As Object

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob van Gelder"

wrote in message
...
This request is better asked in an Outlook Newsgroup.

I'm pretty horrible
at
Outlook automation, so it would be a good idea to get

this verified.


Sub test()
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTask As Outlook.TaskItem

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject

("Outlook.Application")
On Error GoTo 0

If Not objApp Is Nothing Then
Set objNS = objApp.GetNamespace("MAPI")
objNS.Logon

Set objTask = objApp.CreateItem(olTaskItem)
objTask.Subject = Range("A1").Value
objTask.DueDate = Range("B1").Value
objTask.Save

Set objTask = Nothing
Set objApp = Nothing
End If
End Sub



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Lorna" wrote in

message
...
How can I send a task (outlook) from an excel file.
Also this task must contain some information from this
excel file (some cells).

And after the recipient has finished the task, outlook
must the filled the excel file with some data.

Thanks






.



All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com