Micro Focus QTP (UFT) Forums

Full Version: How to close a Window obj with a "text:="& ReportName
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently, the code below close all of my objects with micclaasss = window. I need to close a Window obj with a "text:="& ReportName & ".*" only.

How do I add this in?

Code:
Sub CloseWindow (ReportName)

   'CLOSE REPORTNAME BROWSER
        Set oWindow=Description.Create()
        oWindow("micclass").Value="Window"
        Set obj=Desktop.ChildObjects(oWindow)
        For i=0 to obj.Count-1
        obj(i).Close
        Next

End Sub

Do i just add:
oWindow("text").Value=ReportName
Code:
oWindow("text").Value="ReportName.*"
Rajpes,

thx

Should it not be:
oWindow("text").Value= ReportName & ".*"

ReportName is a dynamic variable.

Either way, this did not close the Window with the ReportName that I had hoped. It closed all of my windows even messing with logging me off. lol
Code:
Set oWindow=Description.Create()
oWindow("micclass").Value="Window"
oWindow("text").Value=ReportName&".*"
Set obj=Desktop.ChildObjects(oWindow)

msgbox obj.count