vba-传递listbox作为参数

'反选
Private Sub CommandButton1_Click()
 Call Testss(Me!TIListBox)
End Sub

Private Function Testss(ByRef lb As Object)
 If lb.ListCount < 1 Then
     MsgBox "请先获取数据表字段"
     Exit Function
  End If
  Dim i As Integer
  For i = 0 To lb.ListCount - 1
  If lb.Selected(i) = True Then
     lb.Selected(i) = False
  Else
     lb.Selected(i) = True
  End If
  Next
End Function

 

posted @ 2022-12-05 14:21  vba是最好的语言  阅读(194)  评论(0编辑  收藏  举报