When I upgraded to OL2007, Buck's great little macros stopped working. Today, I finally got the guts to ask the Outlook guys what they broke improved. The answer was simple enough. I'll let the code do the talking:
Sub LinkToWorkItem() Set oDoc = ActiveInspector.WordEditor Set oWord = oDoc.Application Set oSelection = oWord.Selection '' Convert the current selection to a work item hyperlink' oDoc.Hyperlinks.Add Anchor:=oSelection.Range, Address:= _ "http://tfserver:8080/WorkItemTracking/Workitem.aspx?artifactMoniker=" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.TextEnd SubSub LinkToKB() Set oDoc = ActiveInspector.WordEditor Set oWord = oDoc.Application Set oSelection = oWord.Selection '' Convert the current selection to a KB article hyperlink' oDoc.Hyperlinks.Add Anchor:=oSelection.Range, Address:= _ "http://support.microsoft.com/kb/" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.TextEnd SubSub LinkToChangeset() Set oDoc = ActiveInspector.WordEditor Set oWord = oDoc.Application Set oSelection = oWord.Selection '' Convert the current selection to a changeset hyperlink' oDoc.Hyperlinks.Add Anchor:=oSelection.Range, Address:= _ "http://tfserver:8080/VersionControl/VersionControl/Changeset.aspx?artifactMoniker=" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.TextEnd Sub
LinkToKB() technically doesn't have anything to do with TFS, but I went ahead and added it while I was playing with Outlook macros. In the next post, you'll see why...