Hyperlinking Macro Help RRS feed

  • Question

  • Hi all,

    Currently I have a column in my project in which I put a reference number for each task. That number is used to look up the task on another website. Right now, I have the column as a Hyperlink, and the reference number links to the individual record on the other site. Like so:

    I simply change the number on the end for each line.

    My question is this: Is it possible to write a macro that works like this:

    a) I type in the number.
    b) The macro pastes the base link, and appends the number I pasted to the end
    c) The number is automatically linked to the record on the other site.

    Is this even possible? If yes, can someone perhaps provide a bit of guidance on how exactly to do it? I appreciate your help.

    Monday, June 20, 2016 6:22 PM

All replies

  • Kit P,

    I've never used hyperlinks but try this code, it should work. I use the Number1 field for the entered value. I tried it on a simple test file with a summary task and 4 subtasks, you'll have to modify the loop to select only those rows in which you wish to include a hyperlink.


    Sub SetHyper()
    Dim i As Integer
    Dim addr As String
    For i = 2 To 5
        SelectTaskField Row:=i, Column:="number1", rowrelative:=False, Width:=0, Height:=0
        addr = "" & ActiveSelection.Tasks(1).Number1
        InsertHyperlink Name:="othersite", Address:=addr, SubAddress:=""
    End Sub

    Monday, June 20, 2016 8:44 PM