try this
Dim Ordr_Nu
Public Function InsertOrder()
Window("Flight Reservation").Activate
Window("Flight Reservation").WinObject("Date of Flight:").Type "111112"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Los Angeles"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "vamsi"
Window("Flight Reservation").WinButton("Insert Order").Click
Wait 10
' Fetch the order number
Order_Nu=Window("Flight Reservation").WinEdit("Order
No:").GetROProperty("text")
'To display the order number
msgbox Order_Nu
' Return value
InsertOrder=Order_Nu
End FunctionOrdr_Nu=InsertOrder msgbox Ordr_Nu To use Order_Nu in Action, you can use the var Ordr_Nu On Fri, Apr 20, 2012 at 2:03 PM, vamsi reddy <[email protected]> wrote: > Hi All, > Please clarify the below things - Thanks in Advance > Query 1: > ->In the flight application Insert Order, Inserted one record > ->I want to the return the value Order_Nu from the function > ->With in the function Order_Nu is displayed > ->Outside the function 'msgbox Order_Nu' displaying empty msgbox > > Query 2: > How to use function value in QTP Action > > -> I put this function in .vbs associated to action1 in QTP > -> I want to use 'Order_Nu' in Action 1 > > > > > InsertOrder(A) > Public function InsertOrder(byval Order_Nu ) > Window("Flight Reservation").Activate > Window("Flight Reservation").WinObject("Date of Flight:").Type "111112" > Window("Flight Reservation").WinComboBox("Fly From:").Select "Los Angeles" > Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt" > Window("Flight Reservation").WinButton("FLIGHT").Click > Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click > Window("Flight Reservation").WinEdit("Name:").Set "vamsi" > Window("Flight Reservation").WinButton("Insert Order").Click > wait 10 > ' Fetch the order number > Order_Nu=Window("Flight Reservation").WinEdit("Order > No:").GetROProperty("text") > 'To display the order number > msgbox Order_Nu > ' Return value > InsertOrder=Order_Nu > End Function > > msgbox Order_Nu > > -- > 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 > -- Regards, Deepak -- 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
