Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|

VBA

|SharePoint|Consultancy|Newsletter|Contact 
 VBA > Class Modules > Properties - Get< Previous | Next > 

 

Property Get

 
 

used to retrieve a property of a class.

 

 

Department

 
 

This is exactly the same as just using a private variable.

 
 
1
2
3
Public Property Get Department() As String
   Department = msDepartment
End Property
   
 

The following line gets the department by calling the property Get procedure

 
 
4
Call MsgBox(objEmployee.Department)
   

 

Hours Per Week

 
 
5
6
7
Public Property Get HoursPerWeek() As Double
   HoursPerWeek = mdbNormalHours + mdbOvertimeHours
End Property
   


 

Read Only Properties

 

 

Normal Hours

 
 

This property only has a Property Get (no Property Let) which means that it is read-only.

 
 
8
9
10
Public Property Get NormalHours() As Double
   NormalHours = mdbNormalHours
End Property
   

 

Overtime Hours

 
 

This property only has a Property Get (no Property Let) which means that it is read-only.

 
 
11
12
13
Public Property Get OvertimeHours() As Double
   OvertimeHours = mdbOvertimeHours
End Property
   


 Copyright © 2011 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >