MonthName Function [VBA]

The MonthName function returns the localized month name of a specified month number.

警告图标

该功能或常量可通过以下语句启用:Option VBASupport 1,该语句需要放置在模块的每个可执行程序代码的前面。


语法:

MonthName(Month as Integer [,Abbreviate as Boolean])

返回值:

String

参数:

Month: Value from 1 to 12, January to December, whose localized month name need to be returned.

Abbreviate: Optional. A Boolean value that indicates if the month name is to be abbreviated.

错误代码:

5 无效的过程调用

示例:

REM  *****  BASIC  *****

Option VBASupport 1

Sub Example_MonthName

 Dim mBirthday as Integer

 mBirthday = 1

 print mBirthday &" "& MonthName(mBirthday,False)

End Sub