Microsoft Office Tutorials and References
In Depth Information
Practical Class Design
Now that you know what a class is and the mechanics of building one, it’s worth briefly cov
ering some practical tips for building classes.
A Simple Class
It’s quite reasonable to create a class that simply contains only properties and no methods.
(See Figure 14-2.)
Figure 14-2. You can easily build a simple class in the Visual Basic Editor.
You can create this class by following these steps:
Select Insert, Class Module from the VBA main menu.
Select the new class in the Project Explorer, and change the Name property in the
Properties window to Plant.
Enter the following statements into the Edit Window:
Public CommonName As String
Public ScientificName As String
Public Description As String
Public RetailPrice As Currency
Public WholesaleCost As Currency
Public ProductNumber As Long