office交流網--QQ交流群號

Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

通用的Access列錶框全選 全不選 反選的函數

2017-08-27 15:24:00
zstmtony
原創
5121

來源:Access交流網通用開髮平颱函數

作者:tmtony


'列錶框全選函數

Public Function gf_SelectAll(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = True
Next
End Function

'列錶框不全選函數
Public Function gf_DeSelect(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = False
Next
End Function

'列錶框反選函數
Public Function gf_Reverse(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = Not lst.Selected(i)
Next
End Function
分享