Vba excel 2013中通过用户表单的日历
我创建了一个用户表单,以开始日期、结束日期、接收日期作为标签,每个标签上都有一个文本框。由于管理员权限,无法安装日历控件的加载项 我的搜索以安装加载项结束,以安装Calendar control 6.0,但由于错误而失败。在我的计算机上拒绝访问 我的userform工作正常,用户必须手动输入日期。 如何在此处获得日历弹出窗口或任何其他建议,只需单击64位运行的Excel 2013即可输入日期Vba excel 2013中通过用户表单的日历,vba,calendar,excel-2013,userform,Vba,Calendar,Excel 2013,Userform,我创建了一个用户表单,以开始日期、结束日期、接收日期作为标签,每个标签上都有一个文本框。由于管理员权限,无法安装日历控件的加载项 我的搜索以安装加载项结束,以安装Calendar control 6.0,但由于错误而失败。在我的计算机上拒绝访问 我的userform工作正常,用户必须手动输入日期。 如何在此处获得日历弹出窗口或任何其他建议,只需单击64位运行的Excel 2013即可输入日期 谢谢你在这里的时间。多谢各位 我自己解决了。非常感谢你:我如何关闭这个?发布答案并接受它; Functi
谢谢你在这里的时间。多谢各位 我自己解决了。非常感谢你:我如何关闭这个?发布答案并接受它;
Function my_date_selection(ByVal d As Variant) As Date
If Not IsDate(d) Then GoTo L1 'Exit Function
If IsDate(d) = True Then
Load calendar
calendar.SelectedDayNumber = Day(d)
calendar.SelectedMonthNumber = Month(d)
calendar.SelectedYearNumber = Year(d)
End If
L1:
calendar.Show
If calendar.SelectedDayNumber = 0 And _
calendar.SelectedMonthNumber = 0 And _
calendar.SelectedYearNumber = 0 Then
my_date_selection = Date
' user click on the cancel button in the calendar control therefore do nothing
Else
my_date_selection = DateSerial(calendar.SelectedYearNumber, _
calendar.SelectedMonthNumber, _
calendar.SelectedDayNumber)
' my_date_selection = Format(my_date_selection, "DD-MMM-YYYY")
End If
' If my_date_selection < Date Then MsgBox "Invalid Date.": GoTo l1
Unload calendar
End Function