A couple of macros I use to create a new next action in the same project and subproject (new release of Netcentric GTD toolkit)....
Function GetProjectName() As String
Dim itmTask As Outlook.TaskItem
Dim objProperty As UserProperty
Dim projectName As String
Dim i As Integer
If ActiveInspector.CurrentItem.Class = 48 Then
Set itmTask = ActiveInspector.CurrentItem
GetProjectName = ""
Set objProperty = itmTask.UserProperties.Find("Project")
If Not objProperty Is Nothing Then
GetProjectName = itmTask.UserProperties("Project")
End If
End If
GotTheProjectName:
End Function
Function GetSubprojectName() As String
Dim itmTask As Outlook.TaskItem
Dim objProperty As UserProperty
'Dim subprojectName As String
Dim i As Integer
If ActiveInspector.CurrentItem.Class = 48 Then
Set itmTask = ActiveInspector.CurrentItem
GetSubprojectName = ""
Set objProperty = itmTask.UserProperties.Find("Subproject")
If Not objProperty Is Nothing Then
GetSubprojectName = itmTask.UserProperties("Subproject")
End If
End If
GotTheProjectName:
End Function
Function FindProjectFolder() As String
On Error GoTo Err_FindProjectFolder
Dim projectName As String
FindProjectFolder = ExplorerProjectFolderPath
projectName = GetProjectName()
If projectName = "" Then
MsgBox ("This task is not part of a GTD project.")
GoTo Exit_FindProjectFolder
End If
FindProjectFolder = FindProjectFolder & projectName
Exit_FindProjectFolder:
Exit Function
Err_FindProjectFolder:
MsgBox Err.Description
Resume Exit_FindProjectFolder
End Function
Sub newProjectTask()
On Error GoTo Err_NewProjectTask
Dim objApp As Outlook.Application
Dim itmTask As Outlook.TaskItem
Dim newProjectTask As Outlook.TaskItem
Dim projectName As String
Dim subprojectName As String
projectName = GetProjectName()
subprojectName = GetSubprojectName()
If projectName = "" Then
MsgBox ("This task is not part of a project!")
GoTo Exit_NewProjectTask
End If
Set objApp = CreateObject("Outlook.Application")
Set newProjectTask = objApp.CreateItem(olTaskItem)
With newProjectTask
newProjectTask.UserProperties.Add("Project", olText) = projectName
newProjectTask.UserProperties.Add("Subproject", olText) = subprojectName
newProjectTask.UserProperties.Add("GettingThingsDone", olYesNo) = 1
newProjectTask.Display
End With
Exit_NewProjectTask:
Set itmTask = Nothing
Exit Sub
Err_NewProjectTask:
MsgBox Err.Description
Resume Exit_NewProjectTask
End Sub
Just paste these into a macro file in outlook and create a custom toolbar in a outlook task item, and they should work fine. I use this a lot...
Roger
Function GetProjectName() As String
Dim itmTask As Outlook.TaskItem
Dim objProperty As UserProperty
Dim projectName As String
Dim i As Integer
If ActiveInspector.CurrentItem.Class = 48 Then
Set itmTask = ActiveInspector.CurrentItem
GetProjectName = ""
Set objProperty = itmTask.UserProperties.Find("Project")
If Not objProperty Is Nothing Then
GetProjectName = itmTask.UserProperties("Project")
End If
End If
GotTheProjectName:
End Function
Function GetSubprojectName() As String
Dim itmTask As Outlook.TaskItem
Dim objProperty As UserProperty
'Dim subprojectName As String
Dim i As Integer
If ActiveInspector.CurrentItem.Class = 48 Then
Set itmTask = ActiveInspector.CurrentItem
GetSubprojectName = ""
Set objProperty = itmTask.UserProperties.Find("Subproject")
If Not objProperty Is Nothing Then
GetSubprojectName = itmTask.UserProperties("Subproject")
End If
End If
GotTheProjectName:
End Function
Function FindProjectFolder() As String
On Error GoTo Err_FindProjectFolder
Dim projectName As String
FindProjectFolder = ExplorerProjectFolderPath
projectName = GetProjectName()
If projectName = "" Then
MsgBox ("This task is not part of a GTD project.")
GoTo Exit_FindProjectFolder
End If
FindProjectFolder = FindProjectFolder & projectName
Exit_FindProjectFolder:
Exit Function
Err_FindProjectFolder:
MsgBox Err.Description
Resume Exit_FindProjectFolder
End Function
Sub newProjectTask()
On Error GoTo Err_NewProjectTask
Dim objApp As Outlook.Application
Dim itmTask As Outlook.TaskItem
Dim newProjectTask As Outlook.TaskItem
Dim projectName As String
Dim subprojectName As String
projectName = GetProjectName()
subprojectName = GetSubprojectName()
If projectName = "" Then
MsgBox ("This task is not part of a project!")
GoTo Exit_NewProjectTask
End If
Set objApp = CreateObject("Outlook.Application")
Set newProjectTask = objApp.CreateItem(olTaskItem)
With newProjectTask
newProjectTask.UserProperties.Add("Project", olText) = projectName
newProjectTask.UserProperties.Add("Subproject", olText) = subprojectName
newProjectTask.UserProperties.Add("GettingThingsDone", olYesNo) = 1
newProjectTask.Display
End With
Exit_NewProjectTask:
Set itmTask = Nothing
Exit Sub
Err_NewProjectTask:
MsgBox Err.Description
Resume Exit_NewProjectTask
End Sub
Just paste these into a macro file in outlook and create a custom toolbar in a outlook task item, and they should work fine. I use this a lot...
Roger