RIBBON COMBOBOX 问题
Ribbon 中使用了Combobox控件,onchange 事件,Combobox Item 值2月时,给全局变量传递的时3月,请问怎么解决?反复使用三次以后,回复正常值2月;
这是RIbbon XML:
这个是代码:
Public ksrq As Date, jsrq As Date
Sub rCount(control As IRibbonControl, ByRef returnedVal)
returnedVal = 31
End Sub
Sub rID(control As IRibbonControl, index As Integer, ByRef id)
id = control.id & index
End Sub
Sub rLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = index + 1 & "日"
End Sub
'设置默认值
'Sub nMoren(control As IRibbonControl, ByRef returnedVal)
'returnedVal = IIf(Left(control.id, 1) = "k", "2016年", "2020年")
'End Sub
'Sub yMoren(control As IRibbonControl, ByRef returnedVal)
'returnedVal = IIf(Left(control.id, 1) = "k", "1月", "12月")
'End Sub
'Sub rMoren(control As IRibbonControl, ByRef returnedVal)
'returnedVal = IIf(Left(control.id, 1) = "k", "1日", "31日")
'End Sub
'选择年月,保存到变量
Sub ksn_Click(control As IRibbonControl, text As String)
ksrq = DateSerial(Val(Left(text, 4)), Month(ksrq), Day(ksrq))
End Sub
Sub ksy_Click(control As IRibbonControl, text As String)
ksrq = DateSerial(Year(ksrq), Val(Left(text, 2)), Day(ksrq))
MsgBox "You pressed Button " & Val(Left(text, 4))
End Sub
Sub ksr_Click(control As IRibbonControl, text As String)
ksrq = DateSerial(Year(ksrq), Month(ksrq), Val(Left(text, 2)))
End Sub
Sub jsn_Click(control As IRibbonControl, text As String)
jsrq = DateSerial(Val(Left(text, 4)), Month(jsrq), Day(jsrq))
End Sub
Sub jsy_Click(control As IRibbonControl, text As String)
jsrq = DateSerial(Year(jsrq), Val(Left(text, 2)), Day(jsrq))
MsgBox "You pressed Button " & Val(Left(text, 4))
End Sub
Sub jsr_Click(control As IRibbonControl, text As String)
jsrq = DateSerial(Year(jsrq), Month(jsrq), Val(Left(text, 2)))
End Sub
'点击查询按钮
Sub chaxun_click(control As IRibbonControl)
If ksrq > jsrq Then
MsgBox "请重新输入!开始日期不能大于结束日期"
Else
MsgBox "开始日期:" & Format(ksrq, "yyyy-mm-dd") & Chr(13) _
& "结束日期:" & Format(jsrq, "yyyy-mm-dd")
End If
End Sub