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

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

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

Leave a Comment

Share via
Copy link
Powered by Social Snap