I thought this might be of some use to others.

Please see the following thread for the discussion resulting in this code : http://www.purebasic.fr/english/viewtop ... 13&t=58200
Basically, there are examples in these forums of Javascript calling PB functions; but these are instances where the Javascript is running in a web gadget or IE.
What we have here is a similar thing, but with VB Script, and running in the MS Script Control (present on 32-bit versions of Windows) as opposed to a browser etc.
Please download the latest version of COMatePLUS for the demo and a little include file which contains a helper function. Basically, to have a VB script (running in the MSScriptControl) call a PB function, you have to create a COM object and feed this to the script control. This is how you extend the features of VB script. The COM object is the liason between the script and your PB program. The aforementioned include file wraps up all the code (and there's not much of it) dealing with the creation of the COM object.
Regards.