try this
Public Function environmentVarExists(ByVal thisEnvName, ByVal thisType)
On Error Resume Next
Dim tVal
Err.Clear()
thisType = UCase(thisType)
Select Case thisType
Case "OBJ"
Set tVal = Environment(thisEnvName)
Case Else
tVal = Environment(thisEnvName)
End Select
If Err.Number <> 0 Then
environmentVarExists = False
Else
environmentVarExists = True
End If
On Error GoTo 0
End Function
On Wednesday, January 9, 2013 1:37:04 PM UTC+5:30, vamsi 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