Compiling classes

Hi G.D.G. Team

I’m a new user and I’m investigating how the trial version of Xls Padlock works to see if it will suit our purposes, before we purchase. It looks good so far! I’m having an problem at the moment:

In VBA compiler and protection, is it possible to compile a class? How would one handle compilation and calling of class methods and properties?

Example 1a) Here is a class I use called AnnualWeatherForecastRecord

Private MyStartDate As Date

Public Property Get Startdate() As Date
Startdate = MyStartDate
End Property
Public Property Let Startdate(pStartDate As Date)
MyStartDate = pStartDate
End Property

b) I reference it like this:

Private MyAnnualWeatherRecord As AnnualWeatherForecastRecord

MyAnnualWeatherRecord.Startdate = forecastStartDate

Example 2a) There are class function calls sometimes e.g. In class crop:


Public Function CheckIfDead() As Boolean
If Dead(GrowingSeasonLength) Then
CheckIfDead = True
Else
CheckIfDead = False
End If
End Function

b) Called like this:

Dim lCrop As Crop

If lCrop.CheckIfDead Then

Can I compile these classes, or how would I handle that? How would the calls to the compiled code be written.

If this is not possible, I can still try compile the whole file into an exe.

Kind regards
Spartan

This is not possible because we would have to declare one class per script file. Currently, our script editor doesn’t handle more than one file, so classes are not supported.
You could keep your original class in your VBA code and move code of some class methods into the VBA compiler.

Ok, that’s fine, thx.

Regards
Spartan