Help With Function to Update Outlook Task From Excel

adude565

New Member
Joined
May 29, 2015
Messages
1
Hello everybody,

I am using Excel 2013 and Windows 10 software. I have found then used macros that allow me to create Outlook tasks from Excel, but I need help building one that will allow me to update those tasks when needed. Below is the code that I modified to fit my needs after taking it from Automating Tasks. It runs without any error, but it does not update the task in Outlook. Any suggestions? Thank you all in advance for your help and time, I hope I am complying with all of the guidelines for posting.

Code:
Sub Get_And_Change_Task()


    Dim olApp As Outlook.Application
    Dim olNs As Namespace
    Dim Fldr As MAPIFolder
    Dim olTsk As TaskItem
    Dim new_start As String, new_end As String, subject As String


    subject = InputBox("Type the name of the activity you wish to make changes to:")
    new_start = InputBox("Enter new start date:")
    new_end = InputBox("Enter new end date:")
    
    Set olApp = New Outlook.Application
    Set olNs = olApp.GetNamespace("MAPI")
    Set Fldr = olNs.GetDefaultFolder(olFolderTasks)


    For Each olTsk In Fldr.Items
        If olTsk.subject = subject Then
            olTsk.StartDate = CDate(new_start)
            olTsk.DueDate = CDate(new_end)
        End If
    Next olTsk


    Set olTsk = Nothing
    Set Fldr = Nothing
    Set olNs = Nothing
    Set olApp = Nothing


End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,213,510
Messages
6,114,048
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top