VBA - WeekDay Name - Tutorialspoint

文章推薦指數: 80 %
投票人數:10人

VBA - WeekDay Name ... The WeekDayName function returns the name of the weekday for the specified day. Syntax. WeekdayName(weekday[,abbreviate[,firstdayofweek]]) ... VBATutorial VBA-Home VBA-Overview VBA-ExcelMacros VBA-ExcelTerms VBA-MacroComments VBA-MessageBox VBA-InputBox VBA-Variables VBA-Constants VBA-Operators VBA-Decisions VBA-Loops VBA-Strings VBA-DateandTime VBA-Arrays VBA-Functions VBA-SubProcedure VBA-Events VBA-ErrorHandling VBA-ExcelObjects VBA-TextFiles VBA-ProgrammingCharts VBA-Userforms VBAUsefulResources VBA-QuickGuide VBA-UsefulResources VBA-Discussion SelectedReading UPSCIASExamsNotes Developer'sBestPractices QuestionsandAnswers EffectiveResumeWriting HRInterviewQuestions ComputerGlossary WhoisWho VBA-WeekDayName Advertisements PreviousPage NextPage  TheWeekDayNamefunctionreturnsthenameoftheweekdayforthespecifiedday. Syntax WeekdayName(weekday[,abbreviate[,firstdayofweek]]) ParameterDescription Weekday−Arequiredparameter.Thenumberoftheweekday. Toabbreviate−Anoptionalparameter.ABooleanvaluethatindicatesifthemonthnameistobeabbreviated.Ifleftblank,thedefaultvaluewouldbetakenasFalse. Firstdayofweek−Anoptionalparameter.Specifiesthefirstdayoftheweek. 0=vbUseSystemDayOfWeek-UseNationalLanguageSupport(NLS)APIsetting 1=vbSunday-Sunday 2=vbMonday-Monday 3=vbTuesday-Tuesday 4=vbWednesday-Wednesday 5=vbThursday-Thursday 6=vbFriday-Friday 7=vbSaturday-Saturday Example Addabuttonandaddthefollowingfunction. PrivateSubConstant_demo_Click() msgbox("Line1:"&WeekdayName(3)) msgbox("Line2:"&WeekdayName(2,True)) msgbox("Line3:"&WeekdayName(1,False)) msgbox("Line4:"&WeekdayName(2,True,0)) msgbox("Line5:"&WeekdayName(1,False,1)) EndSub Whenyouexecutetheabovefunction,itproducesthefollowingoutput. Line1:Tuesday Line2:Mon Line3:Sunday Line4:Tue Line5:Sunday vba_date_time.htm PreviousPage PrintPage NextPage  Advertisements Print  AddNotes  Bookmarkthispage  ReportError  Suggestions Save Close Dashboard Logout



請為這篇文章評分?