F
fionamac
I'm very new to this but I have found a fabulous macro - for managing my
tasks - with user defined fields of "project" and 'next action'. I would like
some guidance to add a function and I was wondering if you could please tell
me what expression to use?
Basically in the body of a task - with a user defined field called 'Project'
The trigger for the "Next Steps" macro is a "- " lead ahead of each
action, with one action per line.
A task to trigger the "Next Steps" code would look like this:
Project: project name
Subject: First Task
Notes/Body field looks like this
- Second Task
- Third Task
- Fourth Task
- Fifth Task
....etc
so by completing the task with the ' Subject: First Task' then action 2
leaves the task body and gets put into the subject field.
For me I sort by 'action' so all the @calls are together when I am at a
phone etc
to do this I include a context under each next action
- call Jane for Luke's email
@calls
- email Luke to set up a time to meet
@computer
- draft up notes for the meeting
@computer
....etc
when the next "-" task moves up from body to subject how do I move the "@"
Action below it move to the the user defined 'Action' Field and move the next
"-" up to the first line of the task body???
here is the macro
' Module : ThisOutlookSession
' Description:
' Procedures : Application_Startup()
' objTaskItems_ItemChange(ByVal pobjItem As Object)
' Modified :
' 11/13/03 WHK
'
' --------------------------------------------------
Private WithEvents objTaskItems As Items
Private Sub Application_Startup()
'TVCodeTools ErrorEnablerStart
On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set objTaskItems = objNS.GetDefaultFolder(olFolderTasks).Items
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
Exit Sub
PROC_ERR:
Call LogError(Err.Number, Err.Description, "Application_Startup", Erl,
"ThisOutlookSession")
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
Private Sub objTaskItems_ItemChange(ByVal pobjItem As Object)
'TVCodeTools ErrorEnablerStart
10 On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim objApp As Outlook.Application
Dim objNewTask As TaskItem
Dim intAns As Integer
Dim strSubject As String
Dim strProject As String
Dim objProperty As UserProperty
20 Set objApp = CreateObject("Outlook.Application")
30 If GetSetting(appname:="GTDPolice", section:="Settings",
key:="Enable", Default:=0) = 1 Then
' Start NetCentrics Addin code
40 Set objProperty = pobjItem.UserProperties.Find("Project")
50 If Not objProperty Is Nothing Then
60 strSubject = pobjItem.Subject
70 strProject = pobjItem.UserProperties("Project")
80 If Not pobjItem.UserProperties("Project") = "" Then
90 If pobjItem.Status = 2 Then
100 intAns = MsgBox("You have completed a Project-related
Task." & vbCrLf & "Task: " & strSubject & vbCrLf & "Project: " & strProject
& vbCrLf & "Do you want to create a new Next Action for the Project?", 36,
"Next Action?")
110 If intAns = 6 Then
120 Set objNewTask = objApp.CreateItem(olTaskItem)
130 With objNewTask
140 objNewTask.UserProperties.Add("Project",
olText) = strProject 'Item.UserProperties("Project")
150
objNewTask.UserProperties.Add("GettingThingsDone", olYesNo) = 1
'objNewTask.Subject = "[" &
Item.UserProperties("Project") & "]"
160 objNewTask.Display
170 End With
180 End If
190 End If
200 End If
210 End If
220 End If
230 Set objApp = Nothing
240 Set objNewTask = Nothing
250 Set objProperty = Nothing
260 Set pobjItem = Nothing
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
270 Exit Sub
PROC_ERR:
280 Call LogError(Err.Number, Err.Description,
"objTaskItems_ItemChange", Erl, "ThisOutlookSession")
290 Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
tasks - with user defined fields of "project" and 'next action'. I would like
some guidance to add a function and I was wondering if you could please tell
me what expression to use?
Basically in the body of a task - with a user defined field called 'Project'
The trigger for the "Next Steps" macro is a "- " lead ahead of each
action, with one action per line.
A task to trigger the "Next Steps" code would look like this:
Project: project name
Subject: First Task
Notes/Body field looks like this
- Second Task
- Third Task
- Fourth Task
- Fifth Task
....etc
so by completing the task with the ' Subject: First Task' then action 2
leaves the task body and gets put into the subject field.
For me I sort by 'action' so all the @calls are together when I am at a
phone etc
to do this I include a context under each next action
- call Jane for Luke's email
@calls
- email Luke to set up a time to meet
@computer
- draft up notes for the meeting
@computer
....etc
when the next "-" task moves up from body to subject how do I move the "@"
Action below it move to the the user defined 'Action' Field and move the next
"-" up to the first line of the task body???
here is the macro
' Module : ThisOutlookSession
' Description:
' Procedures : Application_Startup()
' objTaskItems_ItemChange(ByVal pobjItem As Object)
' Modified :
' 11/13/03 WHK
'
' --------------------------------------------------
Private WithEvents objTaskItems As Items
Private Sub Application_Startup()
'TVCodeTools ErrorEnablerStart
On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set objTaskItems = objNS.GetDefaultFolder(olFolderTasks).Items
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
Exit Sub
PROC_ERR:
Call LogError(Err.Number, Err.Description, "Application_Startup", Erl,
"ThisOutlookSession")
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
Private Sub objTaskItems_ItemChange(ByVal pobjItem As Object)
'TVCodeTools ErrorEnablerStart
10 On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim objApp As Outlook.Application
Dim objNewTask As TaskItem
Dim intAns As Integer
Dim strSubject As String
Dim strProject As String
Dim objProperty As UserProperty
20 Set objApp = CreateObject("Outlook.Application")
30 If GetSetting(appname:="GTDPolice", section:="Settings",
key:="Enable", Default:=0) = 1 Then
' Start NetCentrics Addin code
40 Set objProperty = pobjItem.UserProperties.Find("Project")
50 If Not objProperty Is Nothing Then
60 strSubject = pobjItem.Subject
70 strProject = pobjItem.UserProperties("Project")
80 If Not pobjItem.UserProperties("Project") = "" Then
90 If pobjItem.Status = 2 Then
100 intAns = MsgBox("You have completed a Project-related
Task." & vbCrLf & "Task: " & strSubject & vbCrLf & "Project: " & strProject
& vbCrLf & "Do you want to create a new Next Action for the Project?", 36,
"Next Action?")
110 If intAns = 6 Then
120 Set objNewTask = objApp.CreateItem(olTaskItem)
130 With objNewTask
140 objNewTask.UserProperties.Add("Project",
olText) = strProject 'Item.UserProperties("Project")
150
objNewTask.UserProperties.Add("GettingThingsDone", olYesNo) = 1
'objNewTask.Subject = "[" &
Item.UserProperties("Project") & "]"
160 objNewTask.Display
170 End With
180 End If
190 End If
200 End If
210 End If
220 End If
230 Set objApp = Nothing
240 Set objNewTask = Nothing
250 Set objProperty = Nothing
260 Set pobjItem = Nothing
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
270 Exit Sub
PROC_ERR:
280 Call LogError(Err.Number, Err.Description,
"objTaskItems_ItemChange", Erl, "ThisOutlookSession")
290 Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub