I have a combo box which is populated at runtime with a list of usernames. When the form containing the combobox is called, the user list is added to the dropdowns (in 2 forms) in the manner shown below in function GetUserList. This seems to work OK. I want to dump the contents on the closing of the forms, so I wrote up EmptyUserList. I keep getting a strange error when the code gets to about the 4th iteration of the RemoveItem method.
Using Excel 97 - Help files are no use, they are asking me to obtain an updated help file from my vendor.
Here's what I got:
[joinedupwriting]
"whaddaya mean, 'invalid tag'?!?"
[/joinedupwriting]
![[lightsaber] [lightsaber] [lightsaber]](/data/assets/smilies/lightsaber.gif)
Using Excel 97 - Help files are no use, they are asking me to obtain an updated help file from my vendor.
Here's what I got:
Code:
Public Function GetUserList()
Dim userList() As Variant
i = 0
Application.ScreenUpdating = False
Worksheets("AccessRights").Visible = True
Worksheets("AccessRights").Activate
With Worksheets("AccessRights").Range("A1:A65536")
Set namefind = .Find("END", MatchCase:=True, Lookat:=xlWhole)
If Not namefind Is Nothing Then
numUsers = (namefind.Row) - 1
End If
ReDim userList(numUsers)
For i = 1 To numUsers
Cells(i, 1).Select
userList(i) = Selection.Value
Next i
End With
For i = 2 To numUsers
ChangeAccess.userListing.AddItem (userList(i))
ChangePass.userListing.AddItem (userList(i))
Next i
Worksheets("AccessRights").Visible = xlVeryHidden
Application.ScreenUpdating = True
End Function
Public Function EmptyUserList()
Dim userList() As Variant
i = 0
Application.ScreenUpdating = False
Worksheets("AccessRights").Visible = True
Worksheets("AccessRights").Activate
With Worksheets("AccessRights").Range("A1:A65536")
Set namefind = .Find("END", MatchCase:=True, Lookat:=xlWhole)
If Not namefind Is Nothing Then
numUsers = (namefind.Row) - 1
End If
' ReDim userList(numUsers)
' For i = 1 To numUsers
' Cells(i, 1).Select
' userList(i) = Selection.Value
' Next i
End With
For j = 1 To (numUsers - 1)
ChangeAccess.userListing.RemoveItem (j)
ChangePass.userListing.RemoveItem (j)
Next j
Worksheets("AccessRights").Visible = xlVeryHidden
Application.ScreenUpdating = True
End Function
[joinedupwriting]
"whaddaya mean, 'invalid tag'?!?"
[/joinedupwriting]
![[lightsaber] [lightsaber] [lightsaber]](/data/assets/smilies/lightsaber.gif)