Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   How do I change all past due tasks to today's date? (http://www.outlookbanter.com/outlook-vba/63215-how-do-i-change-all.html)

Mark December 14th 07 07:09 PM

How do I change all past due tasks to today's date?
 
I have a large number of tasks that didn't get done on the assigned date. I
am looking for a way to change all of the past due due dates to today of some
other day in the future. Is there a way I can do this in Outlook 2007?

Eric Legault [MVP - Outlook] December 14th 07 09:07 PM

How do I change all past due tasks to today's date?
 
Sure can - run the macro below!

Sub DeferSelectedTasks()
On Error Resume Next

Dim objSel As Outlook.Selection
Dim objTask As Outlook.TaskItem
Dim dteDeferred As Date
Set objSel = Application.ActiveExplorer.Selection

If objSel.Count = 0 Then Exit Sub 'nothing selected
If Application.ActiveExplorer.CurrentFolder.DefaultIt emType
olTaskItem Then Exit Sub 'wrong active folder type

dteDeferred = FormatDateTime(InputBox("Enter the date you would like to
change the Due Date to for the selected Task Items:" _
, "Change Due Date", Date), vbShortDate)

If Err.Number 0 Then
'bad date
Exit Sub
End If

For Each objTask In objSel
objTask.DueDate = dteDeferred
objTask.Save
Next

Set objSel = Nothing
Set objTask = Nothing
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/


"Mark" wrote:

I have a large number of tasks that didn't get done on the assigned date. I
am looking for a way to change all of the past due due dates to today of some
other day in the future. Is there a way I can do this in Outlook 2007?


Mark December 14th 07 11:57 PM

How do I change all past due tasks to today's date?
 
Thank you for your prompt response. I copied your script into my Macro's
VBE. I then highlighted the tasks that needed a new due date. However, I
received the following error: Compile Error Syntax Error. This opened the VBE
and the first line, Sub DeferSelectedTasks(), is highlighted in yellow.

I'm new to VBA, and I'm not sure what the problem is. Can you help?

Many thanks.

Mark

"Eric Legault [MVP - Outlook]" wrote:

Sure can - run the macro below!

Sub DeferSelectedTasks()
On Error Resume Next

Dim objSel As Outlook.Selection
Dim objTask As Outlook.TaskItem
Dim dteDeferred As Date
Set objSel = Application.ActiveExplorer.Selection

If objSel.Count = 0 Then Exit Sub 'nothing selected
If Application.ActiveExplorer.CurrentFolder.DefaultIt emType
olTaskItem Then Exit Sub 'wrong active folder type

dteDeferred = FormatDateTime(InputBox("Enter the date you would like to
change the Due Date to for the selected Task Items:" _
, "Change Due Date", Date), vbShortDate)

If Err.Number 0 Then
'bad date
Exit Sub
End If

For Each objTask In objSel
objTask.DueDate = dteDeferred
objTask.Save
Next

Set objSel = Nothing
Set objTask = Nothing
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/


"Mark" wrote:

I have a large number of tasks that didn't get done on the assigned date. I
am looking for a way to change all of the past due due dates to today of some
other day in the future. Is there a way I can do this in Outlook 2007?


Eric Legault [MVP - Outlook] December 15th 07 02:58 AM

How do I change all past due tasks to today's date?
 
In the Visual Basic Editor, choose Tools - References. Ensure that the
Visual Basic For Applications and Microsoft Outlook 12.0 Object Library items
are checked.

--
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/


"Mark" wrote:

Thank you for your prompt response. I copied your script into my Macro's
VBE. I then highlighted the tasks that needed a new due date. However, I
received the following error: Compile Error Syntax Error. This opened the VBE
and the first line, Sub DeferSelectedTasks(), is highlighted in yellow.

I'm new to VBA, and I'm not sure what the problem is. Can you help?

Many thanks.

Mark

"Eric Legault [MVP - Outlook]" wrote:

Sure can - run the macro below!

Sub DeferSelectedTasks()
On Error Resume Next

Dim objSel As Outlook.Selection
Dim objTask As Outlook.TaskItem
Dim dteDeferred As Date
Set objSel = Application.ActiveExplorer.Selection

If objSel.Count = 0 Then Exit Sub 'nothing selected
If Application.ActiveExplorer.CurrentFolder.DefaultIt emType
olTaskItem Then Exit Sub 'wrong active folder type

dteDeferred = FormatDateTime(InputBox("Enter the date you would like to
change the Due Date to for the selected Task Items:" _
, "Change Due Date", Date), vbShortDate)

If Err.Number 0 Then
'bad date
Exit Sub
End If

For Each objTask In objSel
objTask.DueDate = dteDeferred
objTask.Save
Next

Set objSel = Nothing
Set objTask = Nothing
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/


"Mark" wrote:

I have a large number of tasks that didn't get done on the assigned date. I
am looking for a way to change all of the past due due dates to today of some
other day in the future. Is there a way I can do this in Outlook 2007?



All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com