Rob,
Great question (which is usually an intro into a highly opinionated
discourse<vbg>).
As has been pointed out, Function (can) return a value, but it doesn't have
to. So in your example a call to Test works in the same manner, regardless
of whether it is a Sub or a Function.
Paul Lomax, in VB & VBA In A Nutshell (O'Reilly ISBN: 1-56592-358-8)
suggests that you should never use Subs for a custom procedure, always use
Functions, precisely because Functions can return a value. At a minimum this
could be a Boolean indicating successful or unsuccessful completion of that
procedure. I find myself drawn to this argument, as I am sure that you are
like me, and omit error handling in many cases (this code will never error
so why bother - FLW). By using a function you can return the procedure
status to the caller very simply. Clearly, it gets more difficult if you
have a function that needs to return some other value.
Paul has also tested the performance of a call to a sub or a function, and
has found no discernible difference. Of course, there is often an extra
statement in a function, namely that of setting the return value.
As I say, I am drawn to Paul's argument on a theoretical basis, but I do not
rigorously adhere to it, but that is laziness or sloppiness on my part, not
for any other good, pre-determined reason.
In summary, I concur with Paul's reasoning that using Function calls makes
good sense, but apply in my own style (typical programming I guess) and for
specific purpose rather than as a blanket procedure.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)