Line is a range with at least two rows containing XY coordinatesof the polyline. Points is a range with XY coordinates of one or more points.
Pdist returns an array of 3 values for each point:
The distance from the point to the nearest segment, and the X and Y components of this distance.
Open source code is included in the download file.
The screen shot below shows output from this function.