Brian Sardeson gives us three VBA (Visual Basic for Applications) functions: SnapMidPoint returns the midpoint of a given line entity, SnapPerpendicular returns a point perpendicular to a given object from a given point, and MakePoint accepts three real numbers (x,y,z) and returns a three-element array of doubles. Note that these are specialized functions intended for use inside larger routines; they will not do anything on their own. Brian has included an example function named Test_DrawWithSnaps that illustrates the use of all three of these functions. You can use this example as a guide for applying these functions in your own code.
(Note that VBA functionality is not included with AutoCAD 2010 or later, although it can be added with an add-on from Autodesk.)