WeekdayName 函数 [VBA]

The WeekdayName function returns the weekday name of a specified day of the week.

警告图标

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


语法:

WeekdayName(Weekday as Integer [,Abbreviate as Boolean [,FirstDayofWeek as Integer]])

返回值:

String

参数:

Weekday: Value from 1 to 7, Mon­day to Sun­day, whose Week Day Name need to be calculated.

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

FirstDayofWeek: Optional. Specifies the first day of the week.

每周的第一天:

已命名的常量

数值

说明

vbUseSystemDayOfWeek

0

Use National Language Support (NLS) API setting

vbSun­day

1

周日 (默认)

vbMonday

2

星期一

vbTuesday

3

星期二

vbWednesday

4

星期三

vbThursday

5

星期四

vbFriday

6

星期五

vbSaturday

7

星期六


错误代码:

示例:

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

Option VBASupport 1

Sub Example_WeekdayName

 Dim tgf as Integer

 tgf = 6

 print tgf &" "& WeekdayName(tgf,False,vbSunday)

End Sub