Check this Out and update as per ur req

Public Function GetRandomString(ByVal iLength As Integer) As String
    Dim intMax, iLoop, k, intValue, strChar, strName, intNum

    ' Specify the alphabet of characters to use.
    Const Chars = 
"abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ' Specify length of names.
    'intMax = 5
    intMax = iLength
    ' Specify number of names to generate.
    

    Randomize

    strName = ""
    For k = 1 To intMax
        ' Retrieve random digit between 0 and 25 (26 possible characters).
        intValue = Fix(62 * Rnd())
        ' Convert to character in allowed alphabet.
        strChar = Mid(Chars, intValue + 1, 1)
        ' Build the name.
        strName = strName & strChar
    Next

    GetRandomString = strName
End Function

On Wednesday, April 1, 2015 at 5:06:29 PM UTC+5:30, Mahesh wrote:
>
> Need to Generate a random alpha numeric number where the first two char 
> should be alphabets and rest of them should be numbers
>
> example AB123456, Ac5356 MA4567
>
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to