If anyone needs it, here it is. I actually just needed to be able to test a line segment, and I don't care about the intersected point:
'flags
'1 - infinite ray
Function PointRayDistance#( px#,py#,pz#, ax#,ay#,az#, bx#,by#,bz#,flags=0)
bx=ax+bx
by=ay+by
bz=az+bz
If Not (1 & flags)
diffx#=px-ax
diffy#=py-ay
diffz#=pz-az
dirx#=bx-ax
diry#=by-ay
dirz#=bz-az
dot1#=dotproduct(diffx,diffy,diffz,dirx,diry,dirz)
If dot1<0.0 Return PointDistance(px,py,pz,ax,ay,az)
dot2#=dotproduct(dirx,diry,dirz,dirx,diry,dirz)
If dot2<dot1 Return PointDistance(px,py,pz,bx,by,bz)
EndIf
'get the length of each side of the triangle ABP
ab# = Sqr( (bx-ax)*(bx-ax) + (by-ay)*(by-ay) + (bz-az)*(bz-az) )
bp# = Sqr( (px-bx)*(px-bx) + (py-by)*(py-by) + (pz-bz)*(pz-bz) )
pa# = Sqr( (ax-px)*(ax-px) + (ay-py)*(ay-py) + (az-pz)*(az-pz) )
'get the triangle's semiperimeter
semi# = (ab+bp+pa) / 2.0
'get the triangle's area
area# = Sqr( semi * (semi-ab) * (semi-bp) * (semi-pa) )
'Return closest distance P To AB
Return (2.0 * (area/ab))
End Function