Loan Object Implementation Details : Class « Data Type Functions « VBA / Excel / Access / Word






Loan Object Implementation Details

 
Option Explicit 


Public PrincipalAmount As Variant 
Public InterestRate As Variant 
Public LoanNumber As Variant 
Public Term As Variant 

Private Sub Class_Initialize() 
    PrincipalAmount = 0 
    InterestRate = 0.08 
    LoanNumber = 0 
    Term = 36 
End Sub 

Public Property Get Payment() As Variant 
    Payment = Application.WorksheetFunction.Pmt _ 
        (InterestRate / 12, Term, -PrincipalAmount) 
End Property 

Public Property Get PrincipalAmount() As Variant 
    PrincipalAmount = mvPrincipalAmount 
End Property 

Public Property Let PrincipalAmount(ByVal vNewValue As Variant) 
    mvPrincipalAmount = vNewValue 
End Property 

Public Property Get InterestRate() As Variant 
    InterestRate = mvInterestRate 
End Property 

Public Property Let InterestRate(ByVal vNewValue As Variant) 
    mvInterestRate = vNewValue 
End Property 

Public Property Get LoanNumber() As Variant 
    LoanNumber = mvLoanNumber 
End Property 

Public Property Let LoanNumber(ByVal vNewValue As Variant) 
    mvLoanNumber = vNewValue  
End Property 

Public Property Get Term() As Variant 
    Term = mvTerm 
End Property 

Public Property Let Term(ByVal vNewValue As Variant) 
    mvTerm = vNewValue 
End Property 

Public Property Get Payment() As Variant 
    Payment = Application.WorksheetFunction.Pmt _ 
        (mvInterestRate / 12, mvTerm, -mvPrincipalAmount) 
End Property 

 








Related examples in the same category

1.Creating Custom Objects
2.Creating and Using a Class Module
3.Class Module: FileInformation
4.Class Module: FullName
5.The SimpleLoan Class
6.Rectangle class
7.Creating the MyRectangle Class
8.Abstraction