Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
Txt_Prod_Loc_Date.Value = MonthView1.Value
Unload Me
End Sub
Private Sub FrmCalendar_Initialize()
Unload Me
End Sub
我也试过Txt_Prod_Loc_Date.Value = DateClicked。但我看到一个"运行时错误424,需要对象
由于
答案 0 :(得分:1)
你可以同时使用两者; MonthView1.Value
或DateClicked
。问题不在于:)
BTW为什么Unload Me
中有FrmCalendar_Initialize()
?这会给你一个Run Time Error 91. Object Variable or With block variable Not set
您收到Runtime error 424, object required
,因为它无法在您的用户表单中找到Txt_Prod_Loc_Date
控件。
如果该控件在工作表中,那么就像这样使用它
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
Sheet1.TextBox1.Value = MonthView1.Value
End Sub
如果该控件采用其他形式(比如Userform1
),那么就像这样使用它
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
UserForm1.Txt_Prod_Loc_Date.Value = MonthView1.Value
End Sub