本帖最后由 pcl_test 于 2017-4-13 09:38 编辑
| dim fanhuizhi | | fanhuizhi=checkdate(2,31,2015) | | if fanhuizhi <> "" then | | msgbox fanhuizhi,48,"报错信息" | | else | | msgbox "you xiao" | | end if | | | | | | function checkdate(smonth,sday,syear) | | on error resume next | | dim date1 | | date1=cdate(sday&"/"&smonth&"/"&syear) | | if err.number <> 0 then | | err.clear | | date1=dateadd("m",1,smonth&"/"&syear) | | date1=dateadd("d",-1,date1) | | checkdate="there are only "&day(date1)&" days in "&smonth | | else | | checkdate="" | | end if | | end functionCOPY |
当调用函数的参数为无效日期2015年2月31号时,从第13行到第17行看不懂,日期无效,得到提示信息15年2月只有28天,不知道这个是怎么得到的 |