Outlook Macro to Create a Huge PIGPOG Task

November 18th, 2005 | by GTD Wannabe |

So, I have quite a few macros to help me do my GTD in Outlook:

But I was still missing something. Sometimes, I want to start writing a pigpog task. I know it’s a pigpog task, and I know at least a few of the actions that I want to write in the body of the Outlook task. I can sort of do it by using my QuickNA macro, and then immediately calling the StartPIGPOG macro. However, that only lets me automatically input the first task in my pigpog list. What if I want to insert 2, 3, or many?

Solution? Another macro of course. To use this macro, start a new task in Outlook. Start the macro. It will ask you a series of questions: project name? next NA? next NA? next NA?…until you hit enter to create a blank NA. Finally, it will ask you a category (or context in GTD-speak). Then the task is created with the project and first NA in the subject line, and all of the NAs are listed, line by line in the body of the task item. The task remains open so yo ucan add dates or other notes, if required.

First, a couple of screen shots:

(1) Starting with a blank task.


(2) Entering an NA. Hit enter when done entering your list of NAs.

(3) After the macro is finished.

And here is the macro code:

Sub MultipleActionPIGPOGFromScratch()'The point of this macro is to start from a blank task'and ask the user for input about the project, the pigpog'tasks and the category.  User can enter as many pigpog tasks'as desired.  The first one becomes the subject line of the task'and all are listed in the body.  The macro is smart enough to'know if there is any text in the subject line already,'cancelling if that is the case.  This is to prevent from'overwriting an existing task by accident.

On Error GoTo NewPigPOG_Error

Dim myTaskItem As Outlook.TaskItemSet myTaskItem = Application.ActiveInspector.CurrentItem

Dim project, nextAction, categoryDim subject, body

myTaskItem.Save

subject = myTaskItem.subject

If Len(subject) > 0 Then   MsgBox "Already information in this task, don't want to overwrite.  Cancelling."   Exit SubEnd If

project = InputBox("Project name?", "Project Name")If Len(project) = 0 Then   project = ""Else   project = "[" + project + "] "End If

' start new notes with PIGPOGbody = "PIGPOG" + Chr(13) + Chr(10) + Chr(13) + Chr(10)

' Loop: keep asking for a new pigpog NA.  As long as the' new NA is not null length, add it.' If it's the first one, add it to the subject line

Dim first, done As Booleanfirst = Falsedone = False

Do While Not done   nextAction = InputBox("What's the next PIGPOG NA? (Blank to end series.)", "Next PIGPOG NA")   'MsgBox nextAction

   If Len(nextAction) = 0 Then       'MsgBox "len is zero, should be ending"       done = True   End If   If Not first And Not done Then       'MsgBox "in first if, should be setting sujbect line"       first = True       subject = project + nextAction   End If   'MsgBox "out of ifs, next line sets the next line in the boddy"   nextLine = "- " + nextAction + Chr(13) + Chr(10)   'MsgBox nextLine   If Not done Then       body = body + nextLine   End If   'MsgBox "first = " + first + " done = " + doneLoop

category = InputBox("What's the context?", "New Context")

If Left(category, 1) = "@" Then   myTaskItem.Categories = categoryElse   myTaskItem.Categories = "@" + categoryEnd If

myTaskItem.subject = subjectmyTaskItem.body = body

' To just save the itemmyTaskItem.Save' Now close it manually (maybe I want to add comments, or dates)

Exit Sub

NewPigPOG_Error:MsgBox "Error" + Err.Number + " (" + Err.Description + ") in procedure NewPIGPOG"

End Sub

Categories: , ,

Update [28 Feb 06]: Replacing & with +. Both can be used for concatenation; + shouldn’t be wrecked by html, like & can be.

  1. 4 Responses to “Outlook Macro to Create a Huge PIGPOG Task”

  2. By on Nov 18, 2005 | Reply

    This is exactly what I’ve been looking for. I think. ;) I’m going to install it and try it out.

    Thanks!
    rbw

  3. By on Feb 28, 2006 | Reply

    Hi there

    I am having problem with the:

    ‘ start new notes with PIGPOG
    body = “PIGPOG” & Chr(13) & Chr(10) & Chr(13) & Chr(10)

    my outlook 2003 does not accept that.

    Can you help me out here?

  4. By on Feb 28, 2006 | Reply

    There seems to be a problem every now and then with the ampersand & character; it goes into the post nicely, but for some reason an ampersand or two will be converted to & a m p ;. To get around that I’ve just changed them to plus signs +. These also work for concatenation, and shouldn’t be messed with by the html monsters.

  1. 1 Trackback(s)

  2. Dec 27, 2007: Manage This! » Blog Archive » Forever Tasks – How do *you* handle them?

Sorry, comments for this entry are closed at this time.