A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Mass changing Task Due Dates



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 11th 07, 02:50 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default Mass changing Task Due Dates

Is there a way to mass change task due dates?

I generally have several tasks due today. However, I may only fully complete
one or two of them. I want to mass change the others so that they are changed
to the next day, next week, etc., without going into each one individually.

I can't find any standard functionality for this. VBA may be my best hope,
but I am not sure how to program this in Outlook. I am experienced with VBA
in Excel, but not in Outlook.

Thanks!

Ads
  #2  
Old July 11th 07, 06:20 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Mass changing Task Due Dates

Try this code:

Sub RecurseTasks()
On Error GoTo RecurseTasks_Error

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTasksFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objTaskItem As Outlook.TaskItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
'Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")
Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd") & "'")

For Each objTaskItem In objItems
Debug.Print objTaskItem.Subject & " (Start: " &
objTaskItem.startDate & "; End: " & objTaskItem.DueDate
'or edit task:
' objTaskItem.DueDate = #8/31/2007#
' objTaskItem.Save
Next

Set objOL = Nothing
Set objNS = Nothing
Set objTasksFolder = Nothing
Set objTaskItem = Nothing
Set objItems = Nothing

On Error GoTo 0
Exit Sub

RecurseTasks_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RecurseTasks of Module basTasksMacros"
Resume Next
End Sub

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Mike" wrote:

Is there a way to mass change task due dates?

I generally have several tasks due today. However, I may only fully complete
one or two of them. I want to mass change the others so that they are changed
to the next day, next week, etc., without going into each one individually.

I can't find any standard functionality for this. VBA may be my best hope,
but I am not sure how to program this in Outlook. I am experienced with VBA
in Excel, but not in Outlook.

Thanks!

  #3  
Old July 17th 07, 02:32 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default Mass changing Task Due Dates

Thanks. Here is a small update to the code. It works!

Also, I want to make these small improvements. Any ideas?
1. Only change the tasks I selected
2. Have pop-up box to either choose: Today or a Manually Entered Date.

Cheers!

Here is my updated code!



Sub UpdateTask_DueDate()
'Purpose: To update old tasks (with old Due Dates) to Today

On Error GoTo RecurseTasks_Error

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTasksFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objTaskItem As Outlook.TaskItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
Set objItems = objTasksFolder.Items.Restrict("[Due Date] '" &
Format(Date, "ddddd") & "'")

For Each objTaskItem In objItems
' Debug.Print objTaskItem.Subject & " (Start: " &
objTaskItem.StartDate & "; End: " & objTaskItem.DueDate
'or edit task:
objTaskItem.DueDate = Date
' objTaskItem.DueDate = #8/31/2007#
objTaskItem.Save
Next

Set objOL = Nothing
Set objNS = Nothing
Set objTasksFolder = Nothing
Set objTaskItem = Nothing
Set objItems = Nothing

On Error GoTo 0
Exit Sub

RecurseTasks_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RecurseTasks of Module basTasksMacros"
Resume Next
End Sub











"Eric Legault [MVP - Outlook]" wrote:

Try this code:

Sub RecurseTasks()
On Error GoTo RecurseTasks_Error

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTasksFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objTaskItem As Outlook.TaskItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
'Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")
Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd") & "'")

For Each objTaskItem In objItems
Debug.Print objTaskItem.Subject & " (Start: " &
objTaskItem.startDate & "; End: " & objTaskItem.DueDate
'or edit task:
' objTaskItem.DueDate = #8/31/2007#
' objTaskItem.Save
Next

Set objOL = Nothing
Set objNS = Nothing
Set objTasksFolder = Nothing
Set objTaskItem = Nothing
Set objItems = Nothing

On Error GoTo 0
Exit Sub

RecurseTasks_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RecurseTasks of Module basTasksMacros"
Resume Next
End Sub

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Mike" wrote:

Is there a way to mass change task due dates?

I generally have several tasks due today. However, I may only fully complete
one or two of them. I want to mass change the others so that they are changed
to the next day, next week, etc., without going into each one individually.

I can't find any standard functionality for this. VBA may be my best hope,
but I am not sure how to program this in Outlook. I am experienced with VBA
in Excel, but not in Outlook.

Thanks!

  #4  
Old July 17th 07, 05:10 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Mass changing Task Due Dates

Look to the Explorer.Selection object to give you a collection of items that
are selected in the active folder.

For full control over presenting the user with options, design a UserForm
with your custom UI. Otherwise, for simplicity you can use VBA's InputBox
function to prompt for a value (you can provide a default value for the user
as well).

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Mike" wrote:

Thanks. Here is a small update to the code. It works!

Also, I want to make these small improvements. Any ideas?
1. Only change the tasks I selected
2. Have pop-up box to either choose: Today or a Manually Entered Date.

Cheers!

Here is my updated code!



Sub UpdateTask_DueDate()
'Purpose: To update old tasks (with old Due Dates) to Today

On Error GoTo RecurseTasks_Error

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTasksFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objTaskItem As Outlook.TaskItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
Set objItems = objTasksFolder.Items.Restrict("[Due Date] '" &
Format(Date, "ddddd") & "'")

For Each objTaskItem In objItems
' Debug.Print objTaskItem.Subject & " (Start: " &
objTaskItem.StartDate & "; End: " & objTaskItem.DueDate
'or edit task:
objTaskItem.DueDate = Date
' objTaskItem.DueDate = #8/31/2007#
objTaskItem.Save
Next

Set objOL = Nothing
Set objNS = Nothing
Set objTasksFolder = Nothing
Set objTaskItem = Nothing
Set objItems = Nothing

On Error GoTo 0
Exit Sub

RecurseTasks_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RecurseTasks of Module basTasksMacros"
Resume Next
End Sub











"Eric Legault [MVP - Outlook]" wrote:

Try this code:

Sub RecurseTasks()
On Error GoTo RecurseTasks_Error

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objTasksFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objTaskItem As Outlook.TaskItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
'Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd h:nn AMPM") & "'")
Set objItems = objTasksFolder.Items.Restrict("[Due Date] = '" &
Format(Date, "ddddd") & "'")

For Each objTaskItem In objItems
Debug.Print objTaskItem.Subject & " (Start: " &
objTaskItem.startDate & "; End: " & objTaskItem.DueDate
'or edit task:
' objTaskItem.DueDate = #8/31/2007#
' objTaskItem.Save
Next

Set objOL = Nothing
Set objNS = Nothing
Set objTasksFolder = Nothing
Set objTaskItem = Nothing
Set objItems = Nothing

On Error GoTo 0
Exit Sub

RecurseTasks_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RecurseTasks of Module basTasksMacros"
Resume Next
End Sub

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Mike" wrote:

Is there a way to mass change task due dates?

I generally have several tasks due today. However, I may only fully complete
one or two of them. I want to mass change the others so that they are changed
to the next day, next week, etc., without going into each one individually.

I can't find any standard functionality for this. VBA may be my best hope,
but I am not sure how to program this in Outlook. I am experienced with VBA
in Excel, but not in Outlook.

Thanks!

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Task Due Dates when Grouped by Date Perry Outlook and VBA 0 October 24th 06 01:52 PM
Displaying my Task Due Dates on my calendar Kingry Outlook - Calandaring 3 October 17th 06 11:26 PM
How to sort task due data ascending, tasks w/o dates last? Kenneth Baltrinic Outlook - General Queries 0 September 15th 06 01:40 PM
change task due dates default jaelde Outlook - Calandaring 1 July 11th 06 10:45 AM
Task with overdue dates print in smaller fonts? R. Barre Outlook - General Queries 0 June 8th 06 02:23 AM


All times are GMT +1. The time now is 09:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.