传递表单对象时,VBAtypes不匹配
作为一个新手(对我来说很容易:-),从函数传递信息时,我得到一个types不匹配。
' Generate Data Sub Function Sub Send_listbox_list_to_function() ' Function to Create and populate the class ' -> Require's the listbox and the directory location If Right(frmMain.txtDIR, 1) = "\" Then Call Create_Class(frmMain.lstDIR, frmMain.txtDIR.Value) Else Call Create_Class(frmMain.lstDIR, frmMain.txtDIR.Value + "\") End If End Sub
这是我试图通过信息传递的function。
Sub Create_Class(ByRef lstbox As ListBox, ByVal loc As String) ' Generic Checksheet Dim checksheet As cls_DR End Sub
这在VBA中可能吗? 我很担心使用表单时出现错误。 我无法控制自己的头脑。 帮帮我?
您的参数被声明为错误的Listbox
(Excel库中也有一个)。 你需要使用这个:
Sub Create_Class(ByRef lstbox As MSForms.ListBox, ByVal loc As String)