Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Just copy & paste this VB macro into your Visual Basic editor in MS Project.
It will then enable you to create a MS Outlook task (with reminder) for any currently
highlighted task in your .mpp project plan.
Once implemented you will be able to highlight a MS Project task then execute the
macro. An Outlook task will be created automatically. If the MS Project task contains
Notes then these will also be copied over to the MS Outlook Task.
Note:
1. To execute the macro from the Toolbar, do the following:-
a. Create the macro in the VB Editor
b. Back in MS Project: View Toolbars Customize
c. Commands tab: All Macros
d. Select & Drag Outlook Task to the toolbar
e. Close. Youre done!
2. Tested successfully with MS Project 2000, MS Project 2003, MS Project 2007,
& MS Outlook 2007.
3. Dont forget to also copy the Day_of_the_Week function. It is called by
Outlook_Task
Sub OutlookTask()
'This creates an MS Outlook task, with Reminder, for a selected MS Project Task
With ActiveCell.Task
TaskName = Trim(.Name)
TaskStart = .Start
TaskEnd = .Finish
TaskResources = .ResourceNames
TaskPercentComplete = .PercentComplete
TaskNotes = .Notes
TaskID = .ID
End With
Err.Clear
'Optionally the MS Outlook title can be preceded with the Project Code.
'Especially useful when managing multiple concurrent projects
'Use the File properties in MS Project to vary this parameter
'Add a new property (Type: Text) called 'ProjectCode'
On Error Resume Next
ProjectCode = ActiveProject.CustomDocumentProperties("ProjectCode")
If Err = 0 _
Then
TaskName = (ProjectCode + " - " + TaskName)
End If
Err.Clear
'Optionally you can vary the number of days prior to the Task due date that a reminder appears in Outlook
'The default is 7 days.
'Use the File properties in MS Project to vary this parameter
'Add a new property (Type: Text)called 'ReminderDays'
On Error Resume Next
ReminderDays = ActiveProject.CustomDocumentProperties("ReminderDays")
If Err <> 0 _
Then
ReminderDays = 7
End If
Err.Clear
Useful MS Project VB Macros
1. Create a MS Outlook task from MS Project task
'Check that the Reminder Day is not a weekend. If so, then go the previous working day
ReminderDate = (TaskStart - ReminderDays)
If (Day_of_the_Week(ReminderDate) = "Saturday") _
Then
ReminderDate = (TaskStart - (ReminderDays + 1))
Else
If (Day_of_the_Week(ReminderDate) = "Sunday") _
Then
ReminderDate = (TaskStart - (ReminderDays + 2))
End If
End If
End Sub
===================================================================================================================
Public Function Day_of_the_Week(InputDate)
Dim Days(6)
Days(0) = "Sunday"
Days(1) = "Monday"
Days(2) = "Tuesday"
Days(3) = "Wednesday"
Days(4) = "Thursday"
Days(5) = "Friday"
Days(6) = "Saturday"
Day_of_the_Week = Days(Weekday(InputDate) - 1)
End Function