ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set outlook task through excel (https://www.excelbanter.com/excel-programming/433441-set-outlook-task-through-excel.html)

goodfish

set outlook task through excel
 
Hi,
I have adapted some code I found in JP site on setting outlook tasks through
excel.
I now make it happen on a change event however I have the following doubt.

Am I right in thinking the following code checks if outlook is open and
otherwise opens it. Because I get an error message when I run the code and
outlook is closed.

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

On the other hand if I add the following line after "End If"
olApp.Session.Logon
then I don't get the error message and although I don't see outlook opening
I do find the task when I open it manually.
Can someone please explain the above?
Thanks.


All times are GMT +1. The time now is 03:05 PM.

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