How to call .vbs functions in QTP?

上一篇 / 下一篇  2011-12-07 16:59:48 / 个人分类:QTP

Method 1:

Call .vbs file


File-> Settings-->Resources-->+ button-->show the path of .vbs file-->Click OK button

Click the "Check Syntax button"

It is available for all actions in the test. If you click "Set as Default" It will be available for all the new Tests.


In Test Pane.

Call functionname(parameters)



msgbox var


Method 2:

Executefile "path of .vbs" file


It is used to execute the function dynamically but it is used for only particular action.


You can execute a VB Script. function using the statement

ExecuteFile "File"

Eg: If you have the .vbs (MyVBScript.vbs) file in the path "C:\Temp" then the following statement will call the same:

ExecuteFile "C:\Temp\MyVBScript.vbs"


Note:You cannot debug a file that is called using an  ExecuteFile  statement, or any of the functions contained in the file. In addition, when debugging a test that contains an ExecuteFile statement, the execution marker may not be correctly displayed.





Open Toolbar