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:="https://server:port/WorkItemTracking/Workitem.aspx?artifactMoniker=" & _
       Selection.Text, _
     SubAddress:="", _
     ScreenTip:="Click to view this work item", _
     TextToDisplay:=Selection.Text
End Sub

852