This function returns the distance between two given points. Originally posted here by Ed Jobe.
Code:
  
Public Function XYZDistance(Point1 As Variant, Point2 As Variant) As Double
  'Returns the distance between two points
  Dim dblDist As Double
  Dim dblXSl As Double
  Dim dblYSl As Double
  Dim dblZSl As Double
  'Calc distance
  dblXSl = (Point1(0) - Point2(0)) ^ 2
  dblYSl = (Point1(1) - Point2(1)) ^ 2
  dblZSl = (Point1(2) - Point2(2)) ^ 2
  dblDist = Sqr(dblXSl + dblYSl + dblZSl)
  'Return Distance
  XYZDistance = dblDist
End Function