Linking to Work Items in E-Mail


When discussing work items in e-mail, I often need the ability to insert a link to the work item. Of course, I use Outlook, but I also use Word as my e-mail editor. I use the following macro (mapped to a toolbar button) to convert a highlighted work item ID into a link, such as 12345. Since I find it useful, I thought I’d share it.

Sub MakeWorkItemLink()
   ActiveDocument.Hyperlinks.Add _
     Anchor:=Selection.Range, _
     Address:="http://server:port/WorkItemTracking/Workitem.aspx?artifactMoniker=" & _
       Selection.Text, _
     SubAddress:="", _
     ScreenTip:="Click to view this work item", _
     TextToDisplay:=Selection.Text
End Sub

852

Comments (5)

  1. Buck Hodges says:

    You can also do the same thing to generate changeset links.  For those who haven’t created Outlook macros before, the instructions at the end may be useful.

    http://blogs.msdn.com/buckh/archive/2005/09/20/471746.aspx

  2. BlakeHandler says:

    I’m guessing "no" but will this work if Word is NOT your email editor (one of my clients use Office 2000 but their Outlook is 2003)

  3. barton says:

    You might want to add:

    If Selection.Font.Underline = wdUnderlineNone Then

           Selection.Font.Underline = wdUnderlineSingle

       Else

           Selection.Font.Underline = wdUnderlineNone

       End If

       Selection.Font.Color = wdColorBlue

  4. Martin Woodward give us his TFS Top Tip #4: The Command Line Client is your friend.

    Port 25 has a…

  5. Rob Caron has a great post showing the macro he created in Word that he uses as his email editor (the…

Skip to main content