![]() |
How to pass 2 arguments to a function - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: How to pass 2 arguments to a function (/Thread-How-to-pass-2-arguments-to-a-function) |
How to pass 2 arguments to a function - Rashmi - 08-13-2008 I have created a function for string comaprison in .vbs file The function looks like this and i am getting the return value Code: Public function StringCom(x1,x2) Now i call this function in QTP Code: dim x here x should display the return value from the function When i run this function in qtp, i get the following error message- Type msimatch StringCom Can anybody please provide the right code RE: How to pass 2 arguments to a function - somisays - 08-14-2008 Dear Rashmi, Your code is fine except calling the function. You don need to use the call statement. so instead of this line Code: x =Call StringCom (x1, x2) use Code: x = StringCom(x1,x2) The function is returning so you just need catch the return value into a variable by using the name of the function and parameters. I Would Recommend you to go through the link and learn VB Script http://www.w3schools.com/vbscript/default.asp Hope this is going to be helpful for you. RE: How to pass 2 arguments to a function - Rashmi - 08-14-2008 Thanks for the quick response. |