Actually, I think that code may have a more significant problem with edge-cases involving polyines that are not parallel to the UCS XY plane.
(vlax-curve-getParamAtPoint (vlax-curve-getClosestPointTo (cadr (entsel "\nPick polyline: "))))
will not necessarily give the correct result if the polyline is not in the XY plane of the current UCS.
The pick point returned by (entsel) is always in the UCS XY plane, making it view-dependent, which means that it may only appear to be closer to the desired vertex in the current view projection, but can actually be closer to another vertex.
AFAIK, the correct and only completely-reliable way to acquire a vertex is via (ssget ":S") and (ssnamex)