Is the following formula true as I've just used it and have got the wrong answer and I can't see where I've gone wrong.
$$\frac{|(p-a)X d|}{|d|}$$ where p and a are pints on each line, d is the direction vector of the lines. X standing as cross product - was't sure what symbol to use for that.
Yes it should be correct indeed
$$|(p-a)\times d|=|p-a|\,|d|\,\sin \theta$$
and therefore
$$\frac{|(p-a)\times d|}{|d|}=|p-a|\,\sin \theta$$
As an alternative and to check we can take a fixed point $P_0$ on a line and the parametric form of a point $Q(t)$ on the second line and use that
$$(P-Q(t))\cdot d=0$$
and find $Q_0=Q(t_0)$.