+ Reply to Thread
Results 1 to 9 of 9

Outlook VBA to report all incomplete tasks

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Outlook VBA to report all incomplete tasks

    I want to get Outlook Tasks/To Do data into an Excel report. However I am a noob when it comes to VBA in Outlook. I tried searching for existing code on the net but none of what I tried did what I want. The closest found created a report but it only reported a few of my tasks I had open (It used 'GetDefaultFolder(olFolderTasks)')

    I am guessing that i need to loop through the MAPI? folders? in Outlook to pick up all of my tasks. Below is my attempt at mixing code from over the net to loop through my outlook folders and report any task that is incomplete. However I can't get the code to work. I run it on my Inbox folder and it doesn't detect any tasks. I probably have the looping code wrong but I can't work out where. Can anybody help?

    Please Login or Register  to view this content.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Outlook VBA to report all incomplete tasks

    Here's an example how to export Outlook Task Item to Excel by running the macro in Outlook. Make sure you have the MS Excel Library reference checked. If you only want to export task item with specific criteria, then, add your IF condition accordingly.

    Here's the MS Documentation of all the task item property
    'https://msdn.microsoft.com/en-us/library/office/dn352390.aspx

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Outlook VBA to report all incomplete tasks

    Thanks JieJenn - this is very similar to the nearest match I have found so far (as mentioned in the OP) The code doesn't pick up all my incomplete tasks as it uses GetDefaultFolder instead of looping through all folders to pick up tasks outside the standard Tasks folder.

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Outlook VBA to report all incomplete tasks

    When you say incomplete task, do you mean Status is not equals to "Completed"?

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Outlook VBA to report all incomplete tasks

    Quote Originally Posted by JieJenn View Post
    When you say incomplete task, do you mean Status is not equals to "Completed"?
    Correct. But that is not the problem, as per code in my OP, I can easily deal with those using
    Please Login or Register  to view this content.
    While your code works, it only lists tasks in the default Tasks folder and my tasks are across multiple folders. So I need code which will recursive search all outlook folders & subfolders. I tried writing this myself (see code in post 1) but it doesn't appear to be working.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,887

    Re: Outlook VBA to report all incomplete tasks

    Your code only processes the folders within the folder you selected, not that folder itself.
    Rory

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Outlook VBA to report all incomplete tasks

    Quote Originally Posted by rorya View Post
    Your code only processes the folders within the folder you selected, not that folder itself.
    Yes, I know I have problems with the folder looping. I discovered another error, I am skipping subfolders where their parent folder doesn't contain items!

    I am stepping through the folder loop function to see if I can solve it.

    However I think I may also have problems with reading the tasks themselves (The subprocedure 'CheckFolderForTasks') UPDATE: For one thing, I have just discovered I need to edit the code to pick up mail items flagged as tasks.
    Last edited by mc84excel; 09-10-2018 at 06:27 PM.

  8. #8
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Outlook VBA to report all incomplete tasks

    I made several changes to the code and it looks as if it is starting to work. However there are several problems:
    1. Speed. Looping through the folders is extremely slow. It would be quicker to read the 'To Do' 'view' in Outlook - if that is even possible. But how?
    2. I'm not certain that the looping code is working 100% I would appreciate anyone pointing out if they can see any logic flaw in this code
    3. Not a bug/just haven't coded - If it is not possible to read the To Do view then I need to also pick up the tasks in the Task folder and merge with the mail item tasks.




    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Outlook VBA to report all incomplete tasks

    Persistence occasionally pays off. Below is quick and dirty code which solves this thread.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Tasks Report
    By asia abobaker in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-29-2014, 03:39 AM
  2. [SOLVED] Macro to Add Tasks to outlook -
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 05:56 AM
  3. Excel to set tasks in outlook
    By carloskev in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2011, 07:00 AM
  4. Outlook Tasks - Adding tasks from a worksheet added today or after
    By dpotta in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2010, 07:15 AM
  5. Excel 2007 : Outlook Tasks
    By elew69811 in forum Excel General
    Replies: 0
    Last Post: 07-03-2008, 02:59 PM
  6. Outlook Tasks
    By bmasella in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-04-2007, 12:39 PM
  7. Sending Outlook tasks using VBA (almost there, need help)
    By Roymus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2005, 10:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1