I forgot to add the link array definition at the top of the module:

Dim link(0 To 5) As Integer