November 29th, 2002, 1:44 pm
However, VB (not]VBA)will compile your code into an ActiveX object, which is really a DLL.Upon startup, VB will let you select "ActiveX DLL" as a type of projectSet the name of the class to "Classic", and Using the Project..Properties menu item, set the Project Name toDemoDll.Pour in your code, a good idea to start simple like withOption ExplicitFunction MySQrt(x As Double) As DoubleIf x < 0 Then MySQrt = 0Else MySQrt = Sqr(x)End IfEnd FunctionOnce you've got it to compile you need to run a command line appRegSvr32 DemoDLL.dllIn Excel you need to use menu Tools...References to add a reference to your new library.If you've followed my names then you can write Dim MyLib As New Classicplo = MyLib.MySQrt(-12)VB compiles using a variant upon the C++ compiler which not only hides your code pretty damn well, but may well make it run faster.DominiConnor