Working with multiple excel files

Working with multiple excel files Option Explicit Dim objExcel, myFile1, myFile2, mySheet1, mySheet2, InputRowCount, i, vErrMsg Set objExcel = CreateObject(“Excel.Application”) Set myFile1 = objExcel.Workbooks.Open (“C:UsersLiaquatDesktopInputDataLogin.xls”) Set myfile2 = objExcel.Workbooks.Open (“C:UsersLiaquatDesktopOutputData.xls”) Set mySheet1 = myFile1.Worksheets(1) Set mySheet2 = myFile2.Worksheets(1) InputRowCount = mySheet1.UsedRange.Rows.Count ‘msgBox InputRowCount ‘Reading File from Input Excel File For i = 2 To InputRowCount […]

Database Scripts

 Database Scripting using VBScript 1) Data Driven Testing by fetching test data (All Records) from a database table Dim objConnection, objRecordset ‘Create Database Connection Object, It is used to connect to databases Set objConnection = CreateObject(“Adodb.Connection”) ‘Create Database Recordset Object, It is used to perform operations on database Tables Set objRecordset = CreateObject(“Adodb.Recordset”) ‘Create Connection […]

VBScript Objects

VBScript Objects 1) Object Name: File System Object Purpose: It is Used to work with Drives, Folders and Files in Computer environment How to Create: Set Variable = CreateObject (“Scripting.FileSystemObject”) Note: Set is VBScript statement, CreateObject is VBScript built-in Function, (“Scripting.FileSystemObject”) is Class value ————————————————————– 2) Object Name: Excel Application Object Purpose: It is used […]

VBScript Comments

VBScript Comments Purpose of Comments: To make the code Readable or Understandable To make the code disable from execution Syntax: ——- Use ‘ symbol before the statement Use Rem command followed by space Comment a block of statements a) Select a block of statements b) Use shortcut keys Ctrl + M Uncomment a) Select comment […]

VBScript Fundamentals and Features

Overview on VBScript   Microsoft Visual Basic Scripting Edition (VBScript) brings active scripting to a wide variety of environments, including Web client scripting in Microsoft Internet Explorer and Web server scripting in Microsoft Internet Information Service (IIS). VBScript is also used for Network Administration, System Administration and for UFT Test Automation. If we already know […]

VBScript Data Types

VBScript Data Types VBScript has only one data type called a Variant.  A Variant is a special kind of data type that can contain different kinds of information, depending on how it is used. Because Variant is the only data type in VBScript, it is also the data type returned by all functions in VBScript. […]

VBScript Variables

VBScript Variables I) What is Variable? Definition 1: A named memory location to store the Data. Definition 2:   A variable is a convenient placeholder that refers to a computer memory location where you can store program information that may change during the time your script is running.   Variables store in Primary memory -RAM […]

Excel Comparison Scripts

Excel Comparison Scripting Examples for UFT (formerly QTP) ‘One to One Binary Comparison (2 Excel columns)   Option Explicit   Dim objExcel, objWorkbook, objWorksheet, RecordCount, i, j, Buttons   Dim oButton, Expected, Actual, k   Set objExcel = createObject(“Excel.Application”)   Set objWorkbook = objExcel.Workbooks.Open(“C:Documents and SettingsAdministratorDesktopinput.xls”)   Set objWorksheet = objWorkbook.Worksheets(1)     Set oButton […]

User Defined Functions

User Defined Functions Functions provided by library are not enough for user so to complete their needs user has to define some functions themselves; these are called user defined functions. main () is a user defined function. Means except built in functions user can also define and write small programs as functions to do a […]

VBScript statements

VBScript statements 1) Call Statement Calls a Sub or Function procedure Syntax: Call Sub or Function procedure name (Arguments) Note: Arguments are Optional Example: Call Login (UserID, Password) Call Login (“gcreddy”, “abcd123”) 2) Const Statement Declared Constants, these can be used to replace literal values Syntax: Const Constant Name = Value Example: Const City = […]