MouseUp事件的Excel VBA语法

时间:2015-01-24 12:27:04

标签: excel-vba vba excel

我对事件很陌生,而且我有点挣扎。任何人都可以帮助我理解为什么这样做:

Private Sub ListBox1_Click()

    ActiveSheet.OLEObjects("TextBox3").Object.Text = ActiveSheet.OLEObjects("ListBox1").Object.Value

    ActiveSheet.OLEObjects("ListBox1").Object.Value = ""

End Sub

但是这会导致类型不匹配'第一行错误?

Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

    Button = 1
    Shift = 0

    ActiveSheet.OLEObjects("TextBox3").Object.Text = ActiveSheet.OLEObjects("ListBox1").Object.Value

    ActiveSheet.OLEObjects("ListBox1").Object.Value = ""

End Sub

提前致谢。任何有助于通过其中一些事件的介绍性参考都会受到赞赏。

0 个答案:

没有答案