On Error Resume Next
Err.Clear()
username = environment.Value("uname") password = environment.Value("pwd")
If Err.Number <> 0 Then
Msgbox "something wrong with env"
Else
Msgbox username
Msgbox password
End If
On Error GoTo 0
Better is to put similar code in a method. This method would return true or
false on the basis of err.number value.
Cheers,
Manoj
On Jan 9, 2013 4:59 PM, "vamsi reddy" <[email protected]> wrote:
>
> Hi All,
>
> I Faced a question in an interview
> "How can I check if a environment variable exist or not"
>
> I created Environment variables in File--Settings--Environment--User
> defined(Or through .ENV File)
> And Iam accessing in QTP through below statements
>
> username = environment.Value("uname")
> password = environment.Value("pwd")
>
> Msgbox username
> Msgbox password
>
>
> But How can I check whether the Env exist or not?
>
>
>
>
> --
> Vamsi Reddy
> *
> *
>
> * *
>
>
> --
> 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
"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