Tuesday, June 21, 2011

25 VB / QTP scripts to pep you

Since the subscribers wanted all the scripts to be available in a single page, I have compiled this page with all the scripts we have posted till now. We will be updating this page, as and when we add more VB/QTP scripts in the blog.

How to create word document from QTP?

Sorting of Elements in an Array

VBScript Program to reverse a string without using strreverse

VBScript code to check if a string is Palindrome or not

VBScript: Listing the prime numbers

Validating an input from the user using VBScript

QTP Script to update variables from ini file

QTP code to search data from Excel sheet

QTP code to terminate all instances of Internet explorer using collections

QTP script to send an email from outlook

QTP Code to download attachment from outlook emails

QTP script to login to Gmail using different set of logins from datatable

How to retrieve all the link names and URLs using QTP?

QTP Script to Connect to a Database

QTP Script to get the title of all open browsers

Dealing with Dynamically changing Objects in QTP

Datatable - Import/Export explained with example

GetTOproperties, SetTOproperty, GetTOproperty & GetROproperty - methods explained with example

Related Topics/Scripts:

QTP Best practices
VBScript Operators
QTP Regular Expressions
What are QTP transactions?
QTP Coding standards and guidelines.
Nested loops : Best practice
Master list of VBScript Built-in functions
Various Properties & Methods in QTP


  1. Hi,

    First of all want to Thank You for your useful post.This Software Testing article is very useful for me. I would like to introduce
    another good site which is having Software testing and QTP resource site, Have a
    look on QTPbook

  2. Hello!

    Thank you for the info on your site it is really helpful. I have a problem with my script execution I will appreciate if you could help me fixing my script. I am a starter.

    I am using google.com to write my script and I am trying to automate search text on googlefor multiple search text from excel.
    I used addsheet and importsheet for external excel sheet to import to datatable but when I use getsheet I got error saying sheet does not exist.

    I used err.number and err.description at addsheet and importsheet I did not get any error number and message.

    I used err.number and err.description at getsheet and got I did get error saying sheet does not exist.

    I will appreciate if you could give me some advise on this problem. I used getsheet for other script it worked.

    Can I use other method than getsheet?

    I will appreciate very much for your help and time.

    Have a wonderful week!


    1. Hi Anonymous,

      When u use get sheet method to get the data from ur required sheet then the sheet name should be case sensitive, for example in excel for user name values if u give column name as "Users", then in QTP u have to write vb script as below datatable.getsheet("Users").getrowscount()
      let me know if u have any queries....


  3. shall you give me code for to close advertisement windows in pages of a website


  4. Truely a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic.keep sharing your information regularly for my future reference.

  5. very very good article on qtp vbscripting. explained in simple words


Please leave your comment here...