Financial 模块 (Visual Basic)

更新:2007 年 11 月

Financial 模块包含用于执行财务操作的过程。

备注

此模块支持执行财务计算(如折旧、现值及未来值、利率、回报率和付款)的 Visual Basic 运行时库成员。

成员

DDB

FV

IPmt

IRR

MIRR

NPer

NPV

Pmt

PPmt

PV

Rate

SLN

SYD

 

 

 

示例

本示例使用 Rate 函数计算一笔贷款的利率,假设前提包括:付款总期数 (TotPmts),还贷额 (Payment),贷款的现值或本金 (PVal),贷款的未来值 (FVal),一个用于指示付款截止时间是在付款周期开始还是末尾的数字 (PayType),以及预期利率的近似值 (Guess)。

Sub TestRate()
    Dim PVal, Payment, TotPmts, APR As Double
    Dim PayType As DueDate

    ' Define percentage format.
    Dim Fmt As String = "##0.00"
    Dim Response As MsgBoxResult
    ' Usually 0 for a loan.
    Dim FVal As Double = 0
    ' Guess of 10 percent.
    Dim Guess As Double = 0.1
    PVal = CDbl(InputBox("How much did you borrow?"))
    Payment = CDbl(InputBox("What's your monthly payment?"))
    TotPmts = CDbl(InputBox("How many monthly payments do you have to make?"))
    Response = MsgBox("Do you make payments at the end of the month?", MsgBoxStyle.YesNo)
    If Response = MsgBoxResult.No Then
        PayType = DueDate.BegOfPeriod
    Else
        PayType = DueDate.EndOfPeriod
    End If
    APR = (Rate(TotPmts, -Payment, PVal, FVal, PayType, Guess) * 12) * 100

    MsgBox("Your interest rate is " & Format(CInt(APR), Fmt) & " percent.")
End Sub

请参见

参考

财务摘要

按照任务排列的关键字和成员

Visual Basic 语言关键字

Visual Basic 运行时库成员

不同语言中的关键字的比较