ok here goes. I have the following code for checking if a user exists in a NT domain:

Code:
if NetUserGetInfo(bServer(0), bUsername(0), 3, lpBuf) = ERR_Success) then
        Dim lpBuf As Long
        Dim ui3 As USER_INFO_3
        Dim bServer() As Byte, bUsername() As Byte
        bServer = "\\tempsrv" & vbNullChar
        bUsername = username & vbNullChar
        Call MoveMemory(ui3, ByVal lpBuf, Len(ui3))
msgbox "username " & username & " already exists"
else
blabla create user
end if
and the following code for putting a follownumber at the end of the username:

Code:
username = Left(username, Len(username) - 1) & Right(username, 1) + 1
how can i put this in a loop that if username1 and username2 already exist it creates a username username3 for example???

I hope you know what i mean