Sub AgeCalc( )
‘variable declaration (变量声明)
Dim FullName As String
Dim DateOfBirth As Date
Dim Age As Integer
'assign values to variables (赋值给变量)
FullName = "John Smith"
DateOfBirth = #01/03/1967#
'calculate age (计算年龄)
Age = Year(Now())-Year(DateOfBirth)
'print results to the Immediate window (在立即窗口里打印结果)
Debug.Print FullName & " is " & Age & " years old."
End Sub