There are two ways of doing it
1) Using the split function as shown in solution 2 above
2) using the left right inbuilt functions as shown below (THIS IS VB6 Sample code):
Dim str As String
Dim uname As String
Dim pwd As String
str = ":usernamepassword"
If InStr(1, str, ":") > 0 Then
uname = Left(str, InStr(1, str, ":") - 1)
pwd = Right(str, Len(str) - InStr(1, str, ":"))
Else
uname = str
pwd = ""
End If