VBScript for Automation (QTP/UFT) Testing – Part 5

In VBScript – Part 5, let’s see the following topics:

How to handle Excel files
How to handle Files & Folders (File System Object)

vbscript - part 5

HOW TO HANDLE EXCEL FILES:

Let’s see the syntax and example of some of the important Excel Handling Functions:

TO CREATE EXCEL OBJECT:

Syntax:

TO MAKE EXCEL VISIBLE:

Syntax:

TO ADD AN EXCEL:

Syntax:

TO SAVE AN OPENED EXCEL:

Syntax:

TO OPEN EXISTING EXCEL:

Syntax:

TO OPEN A PARTICULAR SHEET IN AN EXCEL:

Syntax:

TO WRITE DATA IN EXCEL:

Syntax:

TO READ DATA FROM EXCEL:

Syntax:

TO COMPARE THE DATA IN TWO EXCELS:

Syntax:

TO COPY DATA FROM ONE EXCEL TO ANOTHER EXCEL:

Syntax:

REMOVE DATA FROM EXCEL:

Syntax:

TO SAVE WORKBOOK:

Syntax:

TO CLOSE WORKBOOK:

Syntax:

TO QUIT EXCEL:

Syntax:

TO RELEASE SYSTEM RESOURCES:

Syntax:

FILE SYSTEM OBJECT:

Let’s see the syntax and example of some of the important FSO Functions:

TO CREATE FILE SYSTEM OBJECT:

Syntax:

TO CREATE NEW FILE:

Syntax:

Note: default true – overwrite

Example:

TO OPEN A TEXT FILE:

Syntax:

Example:

TO OPEN FILE WITH WRITE PERMISSION:

TO OPEN FILE WITH READ PERMISSION:

TO COPY A TEXT FILE:

Syntax:

Example:

TO MOVE A FILE:

Syntax:

Example:

TO DELETE TEXT FILE:

Syntax:

Example:

TO CREATE A NEW FOLDER:

Syntax:

Example:

TO COPY A FOLDER:

Syntax:

Example:

TO MOVE A FOLDER:

Syntax:

Example:

TO DELETE A FOLDER:

Syntax:

Example:

TO CHECK DRIVE EXISTANCE:

Syntax:

Example:

TO CHECK FILE EXISTANCE:

Syntax:

Example:

TO CHECK FOLDER EXISTANCE:

Syntax:

Example:

TO GET DRIVE DETAILS:

Syntax:

Example:

TO GET FOLDER DETAILS:

Syntax:

Example:

TO GET FILE DETAILS:

Syntax:

Example:

TEXT STREAM OBJECT METHODS:

TO CLOSE OBJECT:

Syntax:

READ:

Syntax:

Example:

TO READ COMPLETELY:

Syntax:

Example:

TO READ LINE BY LINE:

Syntax:

Example:

TO WRITE:

Syntax:

Example:

TO KEEP CURSOR IN A NEW LINE TO WRITE:

Syntax:

Example:

WRITE BLANK LINES:

Syntax:

Example:

At End Of Line:

Syntax:

At End Of Stream:

Syntax:

TO DEALLOCATE FILE SYSTEM OBJECT:

Syntax:

I would like to conclude VBScript – Part 5 here.

VBScript Series:

VBScript for Automation (QTP/UFT) Testing – Part 1

VBScript for Automation (QTP/UFT) Testing – Part 2

VBScript for Automation (QTP/UFT) Testing – Part 3

VBScript for Automation (QTP/UFT) Testing – Part 4

VBScript for Automation (QTP/UFT) Testing – Part 5

VBScript-Part5

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

1 thought on “VBScript for Automation (QTP/UFT) Testing – Part 5”

  1. excellent its spoon feeding … great

Leave a Comment

Share via
Copy link
Powered by Social Snap