Dim TargetDate,StrYear,StrMonth,StrDay Dim StartDate,Strtime TargetDate = Date '获取年月日 StrYear = Year(TargetDate) StrMonth = Month(TargetDate) If Len(strMonth) < 2 Then StrMonth = "0" & StrMonth End If StrDay ="01" '开始日期 StartDate=StrYear & StrMonth & StrDay '结束日期 Strtime=DateSerial(Year(Now), Month(Now)+1 , 1-1) If len(month(Strtime))<2 Then StrMonth="0" & month(Strtime) End if LastDate=Year(Strtime)& StrMonth & day(Strtime) MsgBox StartDate & "|" & LastDate