Outlook macro for work item and changeset hyperlinks -- updated for 2007
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:= _ "https://tfserver:8080/WorkItemTracking/Workitem.aspx?artifactMoniker=" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.Text End Sub Sub 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:= _ "https://support.microsoft.com/kb/" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.Text End Sub Sub 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:= _ "https://tfserver:8080/VersionControl/VersionControl/Changeset.aspx?artifactMoniker=" _ & oSelection.Text, _ SubAddress:="", ScreenTip:="", TextToDisplay:=oSelection.Text End 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...
Comments
Anonymous
June 06, 2007
The comment has been removedAnonymous
June 22, 2007
But how do you bind this macro to a keyboard shortcut?Anonymous
September 11, 2007
When I updated Buck's TFS macros for Outlook 2007 , I neglected to demonstrate how they were installed.