  We demonstrate a method to accurately control the distance between a custom
probe and a sample on a {\mu}m to nm scale. The method relies on the
closed-loop feedback on the angular deflection of an in-contact AFM
microcantilever. High performance in stability and accuracy is achieved in this
method by taking advantage of the small mechanical feedback path between
surface and probe. We describe how internal error sources that find their
origin in the microcantilever and feedback can be minimized to achieve an
accurate and precise control up to 3 nm. In particular, we investigated how
hysteresis effects in the feedback caused by friction forces between tip and
substrate, can be minimized. By applying a short calibration procedure,
distance control from contact to several micrometers probe-sample distance can
be obtained with an absolute nanometer-scale accuracy. The method presented is
compatible with any probe that can be fixed on a microcantilever chip and can
be easily built into existing AFM systems.
