- 积分
- 1609
- 明经币
- 个
- 注册时间
- 2003-8-6
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-9-4 11:56:00
|
显示全部楼层
参考程序如下:
Public Sub Test()
MsgBox "今年是" & GetCNYearName(Year(Now)) & "年!"
End Sub
Public Function GetCNYearName(CurYear As Integer) As String
Dim CNYear_TG As Variant, CNYear_DZ As Variant, CNYear_AN As Variant, Temp As Integer
If CurYear < 4 Then Exit Function
CNYear_TG = Array("甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸")
CNYear_DZ = Array("子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥")
CNYear_AN = Array("鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪")
Temp = ((CurYear - 4) Mod 60) Mod 12
GetCNYearName = CNYear_TG(((CurYear - 4) Mod 60) Mod 10) & CNYear_DZ(Temp) & CNYear_AN(Temp)
End Function |
|