Thursday, 6 March 2014

QTP FUNCTIONS

What is the difference between User-Defined Function & Built-in Function? User-Defined Function Built-Function We Can Create the Functio... thumbnail 1 summary
What is the difference between User-Defined Function & Built-in Function?

User-Defined Function
Built-Function
We Can Create the Functions with Function Names.

Function Add_Numbers()
………………..
End Function

Call Add_Numbers()

No need to Create these type of Functions. With QTP Software (i.e Vbs script) In built Available.  By using that built in functions develop the script.

Ex: To find the string length for this use built-in function:  Len Function. 
x =”Mahesh”
msgbox Len(x)
Output: 6   

Prerequisites to learn Built-In Functions:
  • Clear idea on Different types of Sub Data Types
  • Length of that Sub Data Types
BUILT-IN FUNCTION LIBRARY:

VBScript has many built-in functions that can be used to enhance the speed of development.


RemIt is used to insert comment or use Single quote (‘) for write a comment 

Ex1   rem  This is Insurance Project
        rem  this is Contact Module
        ‘#####################

List of the functions:

1. Conversion Functions (13)- 25
2. String Functions (16)- 30
3. Array Functions (7)
4. Date and Time Functions (23)
5. Math Functions (15)
6. Format Functions / Formatting Strings (4)
7. I/O Functions (3)
8. Miscellaneous Functions (18) / Other Functions
9. Rounding (5)
10. Variants (8)

All List of the functions Syntax:

1. Conversion Functions:


1) Conversion Functions:   Asc   Chr  CBool   CByte   CCur   CDate   CDbl    CInt    CLng   CSng  CStr    Hex    Oct

1) Asc: Returns the ANSI character code corresponding to the first letter in a string.

'ANSI Range Values: A-Z(65 to 90), a-z(97 to 122), 0-9 (48 to 57)

Ex 1:

Dim x 
val = "Hyderabad"
msgbox asc(val)     ' Output=72

msgbox asc("A")     ' Output=65   It returns the value 65
msgbox asc("Z")     ' Output=90
msgbox asc("a")     ' Output=97
msgbox asc("z")     ' Output=122

msgbox asc("ABC") ' Output=65
msgbox asc("*")     ' Output=42

msgbox asc(1)        ' Output=49



Ex 2:

Dim num
num=Asc("B")
msgbox num          ' Output: 66
                            

2) CBool: Converts an expression to a variant of subtype Boolean
              Syntax: CBool(expression)
                         The expression argument is any valid expression.
                         If expression is 0, False is returned; otherwise, True is returned.
    If expression can’t be interpreted as numeric value, a run-time error occurs.

Ex: 

Dim A, B , Check
A = 5 : B = 5                                            'Initialize the variables
Check = CBool(A=B) : msgbox Check            'Output: True
A=0                                                         'Define variable
Check=CBool(A) : msgbox Check                 'Output: False

B=6
Check = CBool(A=B)

msgbox Check                                         ' Output: False

3) CByte: Converts an expression to a variant of subtype Byte
               Syntax: CByte(expression)
                          The expression argument is any valid expression.
               Use the CByte function to provide conversions from any data type to a Byte subtype.

Ex: 
    
Dim MyDouble, MyByte
MyDouble = 125.5678                               'MyDouble is a Double
MyByte  =  CByte(MyDouble)
msgbox MyByte                                        'Output: 126


MyDouble = 200.4678
MyByte = CByte(MyDouble)
msgbox MyByte                                        'Output: 200

4) CCur: Converts an expression to a variant of subtype Currency
             Syntax: CCur(expression)
                        The expression argument is any valid expression.
Ex: 

Dim amt, MyCurr                  'amt is double value
amt = 543.214588  
msgbox amt                        ' amt is a Double.
MyCurr = CCur(amt * 2)        'Convert result of amt * 2 (1086.429176) to a Currency (1086.4292).

msgbox MyCurr                    'Output: 1086.4292         

5) CDate: Converts a valid date and time expression to the variant of subtype Date
               Syntax: CDate(date)
                           The date argument is any valid date expression.
               Use the IsDate function to determine if date can be converted to a date or time.

Ex: 
    
MyDate = "June 6, 2012"            'Define Date 
MyShortDate = CDate(MyDate)    'Convert to Date data type         
msgbox MyShortDate                                'Output: 6/6/2012         

MyTime ="3:22:47 AM"              'Define time.         
MyShortTime = CDate(MyTime)   'Convert to Date data type    
msgbox MyShortTime                               'Output: 3:22:47 AM


6) CDbl: To convert a value / expression into double Note: default variable type is variant     
                                                       or
             Converts an expression to a variant of subtype Double
             Syntax: cdbl(Expression)
Ex 1:      

Dim MyCurr, MyDouble          
MyCurr = CCur(234.456784)              ' MyCurr is a Currency (234.4567).          
msgbox mycurr                                     'Output: 234.4568          

MyDouble = CDbl(MyCurr * 8.2 * 0.01)           
msgbox mydouble             ' Output: Convert result to a Double (19.2254576).

Ex 2:

Dim b

b="100.45"
msgbox VarType(b)  '8 for String


b=Cdbl(b)
msgbox VarType(b)  '5 for Double

Ex3:

val="100.123"
msgbox VarType (val) '8 for String
val=Cdbl (val)


msgbox VarType (val) '5 for Double

Ex4: 

Dim x, y(3)
Msgbox VarType(x) '0 for Uninitialized /Empty

x="India"
Msgbox VarType(x) '8 for String

x="100"
Msgbox VarType(x) '8 for String

x="100.123"
Msgbox VarType(x) '8 for String

x=100
Msgbox VarType(x) '2 for Integer

x=100.123
Msgbox VarType(x) '5 for Double

x=#10/10/2010#
Msgbox VarType(x) '7 for Date

Set x =CreateObject("Scripting.FilesystemObject")
Msgbox VarType(x) '9 for Automation Object

Msgbox VarType(y) '8204

y(0)="abcd"
y(1)=10
y(2)=1.1
y(3)= #10/10/10#

Msgbox VarType(y(0))  '8
Msgbox VarType(y(1))  '2
Msgbox VarType(y(2))  '5

Msgbox VarType(y(3))  '7

7) Chr: Returns the character associated with the specified ANSI character code.


Ex: 
    
Dim char
Char=Chr(65)    
msgbox char        'Output: A  

msgbox Chr(90)   'Output: Z

msgbox Chr(97)   'Output: a

msgbox Chr(122)  'Output: z

msgbox Chr(49)    'Output: 1

msgbox Chr(42)    'Output: *

8) CInt: Returns an expression that has been converted to a Variant of subtype Integer.
  
Ex1:   

msgbox cint(10.3)        'Output: 10


Ex2:   

Dim num     
num=123.45       
myInt=CInt(num)
msgbox MyInt              'Output: 123


Ex3: 

Dim b

b="100.45"
msgbox VarType(b)  '8 for String

b=CInt(b)
msgbox VarType(b)  '2 for Integer

Ex4:

Dim val
val="100"
msgbox VarType (val) '8 for String
val=Cint (val)


msgbox VarType (val) '2 for Integer

Ex5:

val="100.123"
msgbox VarType (val) '8 for String
val=Cint (val)

msgbox VarType (val) '2 for Integer
Msgbox val '100
  
Ex6: 

val="Hyd"
msgbox VarType (val) '8 for String
val=Cint (val)


msgbox VarType (val) 'Error

9) CLng: Converts an expression to a variant of subtype Long
             Syntax: CLng(expression)
                        The expression argument is any valid expression.
             Use the CLng function to provide conversions from any data type to a Long subtype.


Ex:

Dim MyVal1, MyVal2, MyLong1, MyLong2         
MyVal1 = 25427.45:MyVal2=25427.55     ' MyVal1, MyVal2 are Doubles.

MyLong1 = CLng(MyVal1)         'MyLong1 contains 25427       
msgbox MyLong1
          
MyLong2 = CLng(MyVal2)         'MyLong2 contains 25428
msgbox MyLong2

10) CSng: Converts an expression to a variant of subtype Single.
               Syntax: CSng(expression)
                          The expression argument is any valid expression
Ex

Dim MyDouble1, MyDouble2, MySingle1, MySingle2   
                                                  'MyDouble1, MyDouble2 are Doubles.

MyDouble1 = 75.3421115 : MyDouble2 = 75.3421555
MySingle1 = CSng(MyDouble1) ' MySingle1 contains 75.34211
msgbox MySingle1

MySingle2 = CSng(MyDouble2) ' MySingle2 contains 75.34216
msgbox MySingle2 

11) CStr:  To convert a value/expression into string.
                                           Or 
              Converts an expression to a variant of subtype String
     Syntax: Cstr(Expression)
                          The expression argument is any valid expression.
Ex: 
  
Dim MyDouble, MyString
MyDouble = 437.324           ' MyDouble is a Double.
MyString = CStr(MyDouble) 
msgbox mystring                 'Output: MyString contains "437.324".

msgbox VarType(mystring)  '8 for String

12) Hex:  Returns the hexadecimal value of a specified number
              Syntax: Hex(number)
                         number argument is any valid expression.
              We can represent hexadecimal numbers directly by preceding numbers in the proper range with & H.

Ex1:    

Dim MyHex   
        
MyHex = Hex(5)   'Returns 5.           
MyHex = Hex(10)  'Returns A.           
MyHex = Hex(459)  'Returns 1CB


13) Oct:  Returns the octal value of a specified number
             Syntax: Oct (number)
             The number argument is any valid expression.
Ex1:     

Dim MyOct
           
MyOct = Oct(4)   'Returns 4.        
MyOct = Oct(8)  'Returns 10.           
MyOct = Oct(459)  'Returns 713

 2. String Functions:


2) String Functions: InStr     InStrRev      LCase      Left      Len      LTrim     RTrim      Trim       Mid     UCase      Replace     Right     Space    StrComp     String     StrReverse

1) InStr: Returns the position of the first occurrence of one string within another. The search begins at the first character of the string.

Syntax: InStr([start, ] mainstring1, searchstring2[, compare])
Arguments:
start: (Optional) Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. If start contains Null, an error occurs. The start argument is required if compare is specified.

mainstring1: (Required) String expression being searched.

searchstring2: (Required) String expression searched for.

compare: (Optional) Numeric value indicating the type of search. Value 0 means binary comparison and value 1 means text comparison.

Ex:

Str="How do you DO ?"
'Instr

msgbox Instr(1, Str, "DO", 1)
'Output--> 5 , which means it found the string in 5th position for textual comparison

msgbox Instr(1, Str, "DO", 0)
'Output--> 12 , which means it found the string in 12th position for binary comparison

msgbox Instr(6, Str, "do", 0)
'Output--> 0 , which means it did not found the string after the 6th position for binary comparison

2) InStrRev: Returns the position of the first occurrence of one string within another. The search begins at the last character of the string.


Syntax: InStrRev(string1, string2[, start[, compare]])
Arguments:
string1: (Required) String expression being searched.

string2: (Required) String expression being searched for.

start:    (Optional) Numeric expression that sets the starting position for each search. If omitted, -1 is used, which means that the search begins at the last character position. If start contains Null, an error occurs.

compare: (Optional) Numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, a binary comparison  is performed. 
Value 0 means binary comparison and value 1 means text comparison.

Ex:

Str="How do you DO ?"                                 

'InStrRev
'tot:15chrs

msgbox InStrRev(Str,"DO",-1,1)
'Output--> 12 , which means it found the string in 12th position for textual comparison

msgbox InStrRev(Str,"do",-1,0)
'Output--> 5 , which means it found the string in 5th position for binary comparison

msgbox InStrRev(Str,"DO",13,0)
'Output--> 12 , which means it found the string in 12th position for binary comparison

msgbox InStrRev(Str,"DO",10,1)
'Output--> 5 , which means it found the string in 5th position for textual comparison



3) LCase: To Coverts Upper case values into Lower case 
                                        or
                Converts a specified string to lowercase  

Ex1:         Dim val,x
               val="HYDERABAD"
               x=Lcase(val)
               msgbox x                              'O/P: hyderabad

Ex2:         val="Hyderabad"
               x=Lcase(val)
               msgbox x                              'O/P: hyderabad

Ex3:         val="HyderabaD"
               x=Lcase(val)
               msgbox x                              'O/P: hyderabad

Ex4:         val="hyderabad"
               x=Lcase(val)
               msgbox x                       'O/P: hyderabad

Ex5:         x=Lcase("HYDERABAD")
               msgbox x                        'O/P:  hyderabad

Ex6: 

Msgbox LCase("HYDERABAD")       'hyderabad
Msgbox LCase("HYDerabad")         'hyderabad
Msgbox LCase("hyderabad")          'hyderabad
Msgbox LCase("HYDERABAD117")  'hyderabad117

Msgbox LCase(117)                      '117


4) Left: To get specified no. of characters from the left side of the given string.
           Syntax:         variable=Left(string,Lengh)

Ex1:    Dim val,x
          val="Hyderabad"
          x=Left(val,3)
          msgbox x               ' O/P: Hyd

Ex2:    val="9247837478"
          x=Left(val,1)
          msgbox x               ' O/P: 9

Ex3:    val="H92yderabad"
          x=Left(val,3)
          msgbox x               ' O/P: H92

Ex4:    x=Left(9247837478,5)
          msgbox x                     ' O/P: 92478

Ex5:    val=#10-10-10#
          x=Left(val,3)
          msgbox x              ' O/P: 10-

Ex6:    Val="Hyderabad"
          x=Left(Val,0)
          Msgbox x               'O/P: Null

Ex7:    Val="Hyderabad"
          x=Left(Val,12)
          Msgbox x               'O/P: Hyderabad

Ex8:    Val="Hyderabad"
          x=Left(Val)
          Msgbox x              'O/P: Error (Length is Mandatory)


Ex9:

Dim val
val="Hyderabad"
Msgbox Left(val, 3)                'Hyd

Msgbox Left ("India", 2)          'In

Msgbox Left (100,1)               '1

Msgbox Left (100.2345,4)        '100.

Msgbox Left (#10-10-2010#,5) '10/10



5) Len:  To find the length of the given string 
                                     or
            the number of bytes required to store a variable.

Ex1:     Dim Mystring
           mystring=Len("A. Mahesh")
           msgbox mystring                      'O/P:  9


Ex2:     Dim Mystring
           Mystring=Inputbox("Enter a Value")
           Mystring=Len(Mystring)            ‘if enter  abcde   O/P: 5
           Msgbox Mystring                       ‘if enter 454545 O/P: 6

Ex3:

Msgbox Len("Hyderabad")     '9
Msgbox Len(100)                '3
Msgbox Len(100.234)          '7
Msgbox Len(#10/10/10#)    '10
Msgbox Len(#Sep/10/10#)  '9
Msgbox Len(#Dec/10/10#)  '10

Msgbox Len("india")           '5

6) LTrim: To remove the left side spaces of a given string.
         
Ex1:    Dim val, x   
          val = "          VB Script                           "
          x  = LTrim(val)
          msgbox x                    O/P:  “VB Script                 “       
          x = Len(x)
          msgbox x                    O/P:  36 including spaces

Ex2:    Dim val, x
          val = "100                    "
          x  = LTrim(val)
          msgbox x                    O/P:  “100                “    
          x = Len(x)
          msgbox x                    O/P: 23 including spaces

Ex3:    Dim val, x
          val = "                 2#$%^                    "
          x  = LTrim(val)
          msgbox x                       O/P: “2#$%^                    "
          x = Len(x)                        
          msgbox x                      O/P: 25

Ex4:    Dim val, x
          val = "                 VBScript                    "
          x  = LTrim(val)
          msgbox x                     O/P: “VBScript                    "
          x = Len(x)
          msgbox x                    O/P: 28

Ex5:    Dim val, x
          val =       100
          x  = LTrim(val)
          msgbox x
          x = Len(x)
          msgbox x                    O/P: 3

7) RTrim: To remove the right side spaces of a given string.

Ex1:    Dim val
          val =  "VB Script                    "
          x  = RTrim(val)
          msgbox x                    O/P:  “VB Script”    
          x = Len(x)
          msgbox x                    O/P:  9

Ex2:    Dim val
          val =  "                    100                    "
           x  = RTrim(val)
          msgbox x                 O/P:  “             100”
           x = Len(x)
          msgbox x                O/P:  23 including spaces

Ex3:    Dim val
          val =  "                    2#$%^"
          x  = RTrim(val)
          msgbox x                    O/P:  "                    2#$%^"
          x = Len(x)
          msgbox x                    O/P:  25 including spaces

Ex4:    Dim val
          val =  "                    VBScript                    "
          x  = RTrim(val)
          msgbox x                 O/P:  "                    VBScript"
          x = Len(x)
          msgbox x                O/P:  28


Ex5:    Dim val
          val = 100
          x  = RTrim(val)
          msgbox x          O/P: 100         
          x = Len(x)
          msgbox x          O/P:  3

8) Trim: To remove spaces from both (left & right) sides of a string.

Ex1:      Dim MyVar
            MyVar = LTrim("   vb script ")    O/P:  "vb script "
            MyVar = RTrim("   vb script ")    O/P:  "   vb script"
            MyVar = Trim("   vb script ")      O/P:   "vb script"
                           Note: don’t display the quotes in o/p
                
 Ex2.     Dim val, x
            val = "          VB Script"
            x  = Trim(val)
            msgbox x                                      O/P: VBScript
            x = Len(x)
            msgbox x                                      O/P: 9

Ex3:     Dim val, x
           val = "          100"
           x  = Trim(val)
           msgbox x                                        O/P: 100
           x = Len(x)
           msgbox x                                        O/P: 3

Ex4:     Dim val, x
           val = "          2#$%^"
           x  = Trim(val)
           msgbox x                                           O/P:  2#$%^
           x = Len(x)
           msgbox x                                            O/P: 5


Ex5:    Dim val, x
          val = "          VB Script                           "
          x  = Trim(val)
          msgbox x                                O/P: VB Script
          x = Len(x)
          msgbox x                                O/P: 9



Dim val
val="                             VB Script                                "
Msgbox val

Msgbox Trim (val)           'Output: VBScript
Msgbox LTrim (val)          'Output: VBScript                      "

Msgbox RTrim (val)          'Output:                         VBScript"

9) Mid: To get a specified no. of characters from a given string.

Ex1:    Dim P
          P=”Rs.456/-“
          P=mid(P,4,Len(P)-5)  or mid(P,4,5)
          Msgbox P                   O/P: 456

Ex2:    Dim val,x
          val="Hyderabad"
          x=Mid(Val,5,3)
          msgbox x               ' O/P: rab

Ex3:    val="Hyderabad"
          x=Mid(Val,5)
          msgbox x              ' O/P:  rabid

Ex4:    val="9247837478"
          x=Mid(val,6,5)
          msgbox x               ' O/P: 37478

Ex5:    val="H92yderabad"
          x=Mid(val,1)
          msgbox x         ' O/P: H92yderabad

Ex6:    x=Mid(9247837478,5)
          msgbox x               ' O/P: 837478

Ex7:    val=#10-10-10#
          x=Mid(val,5)
          msgbox x               ' O/P: 0/2010

Ex8:   Val=100
         x=Mid(Val,1)
         Msgbox x                 ' O/P: 100
  
Ex9:   Val="Hyderabad"
         x=Mid(Val,6,1)
         Msgbox x                 ' O/P: a

Ex10:  Val="Hyderabad"
          x=Mid(Val,6,0)
          Msgbox x                 ' O/P: Null

Ex11:  Val="Hyderabad"
          x=Mid(Val,12)
          Msgbox x                 ' O/P: Null

Ex12:  Val=#10-10-10#
          x=Mid(Val,3,3)
          Msgbox x                 '  O/P: /10

Ex13:  Val=#2010-10-10#
          x=Mid(Val,5)
          Msgbox x                ' O/P: 0/2010

Ex14:  Val="Hyderabad"
          x=Mid(Val)
          Msgbox x                ' O/P: Error

Ex15:  

Msgbox Left("Hyderabad",3) 'Hyd
Msgbox Mid("Hyderabad",1, 3) 'Hyd

Msgbox Right("Hyderabad",3) 'bad
Msgbox Mid("Hyderabad",7) 'Hyd


Msgbox Mid("Hyderabad",4, 3) 'era

10) UCase: To Coverts Lower case values into Upper case (or)
                   Converts a specified string to uppercase

Ex1:   Dim val,x
         val="HYDERABAD"
         x=Ucase(val)
         msgbox           'O/P: HYDERABAD

Ex2:   val="Hyderabad"
         x=Ucase(val)
         msgbox  x            'O/P: HYDERABAD

Ex3:   val="HederabaD"
         x=Ucase(val)
         msgbox  x             'O/P: HYDERABAD
              
Ex4:   val="hyderabad"
         x=Ucase(val)
         msgbox  x            'O/P: HYDERABAD

Ex5:   x=Ucase("HYDERABAD")
         msgbox   x           'O/P: HYDERABAD

Ex6: 

Msgbox UCase("HYDERABAD")        'HYDERABAD
Msgbox UCase("HYDerabad")          'HYDERABAD
Msgbox UCase("hyderabad")             'HYDERABAD
Msgbox UCase("HYDERABAD117")      'HYDERABAD117

Msgbox UCase(117)                          '117

11) Replace: Replaces a specified part of a string with another string a specified number of times.

Ex1:   mystring=Replace("kb script", "k","v")
         msgbox mystring                               O/P: vb script

12) Right: To get specified number of characters from the right side of a given string.
             Syntax:   variable=Right (string, Lengh)

Ex1:   Dim val, x
         val="Hyderabad"
         x=Right(val,3)
         msgbox x               ' O/P: bad

Ex2:   val="9247837478"
         x=Right(val,1)
         msgbox x                ' O/P: 8

Ex3:   val="H92yderabad"
         x=Right(val,3)
         msgbox x                 ' O/P: bad

Ex4:   x=Right(9247837478,5)
         msgbox x                         ' O/P: 37478

Ex5:   val=#10-10-10#
         x=Right(val,5)
         msgbox x                       ' O/P: /2010

Ex6:   Dim AnyString, MyStr
         AnyString = "Hello World" ' Define string.
         MyStr = Right(AnyString, 1)           ' O/P: d
         MyStr = Right(AnyString, 6)           ' O/P: World
         MyStr = Right(AnyString, 20)     ' O/P: Hello World
Ex7:

Dim val
val="Hyderabad"
Msgbox Right(val, 3) 'bad

Msgbox Right ("India", 2) 'ia

Msgbox Right (100,1) '0

Msgbox Right (100.2345,4) '2345


Msgbox Right (#10-10-2010#,5) '/2010

13) Space:  To return a string consists of a specified number of spaces.

Ex1:  a="sai"
        b="ram"
        x=a & space(6) & b
        msgbox x                  'O/P: sai      ram

14) StrComp: Compares two strings (Binary and textual) and returns a value that represents the result of the comparison.
            It compares two string based on ASCII values and Returns
            -1 (1st less than 2nd), 0 (Equal) and 1 (1st greater than 2nd)
                                  or
 if a) Both are equal, returns 0(zero)
    b) String 1 > string 2, returns 1(one)
    c) String 2 > string 1, returns -1
          
Ex1:    Dim str1, str2, x
          str1="India"
          str2="India"
          x=StrComp(str1,str2,1)
          msgbox x                         'O/P: 0

Ex2:    str1="india"
          str2="INDIA"
          x=StrComp(str1,str2,1)
          msgbox x                        'O/P: 0

Ex3:    str1="India"
          str2="Indian"
          x=StrComp(str1,str2,1)
          msgbox x                         'O/P: -1

Ex4:    str1="Indian"
          str2="Ndia"
          x=StrComp(str1,str2,1)
          msgbox x                        'O/P: -1

Ex5:    str1="Indian"
          str2="India"
          x=StrComp(str1,str2,1)
          msgbox x                          'O/P:  1

Ex6:    str1=100
          str2=100
          x=StrComp(str1,str2,1)
          msgbox x                           'O/P: 0

Ex7:    str1=100
          str2=101
          x=StrComp(str1,str2,1)
          msgbox x                           'O/P: -1

Ex8:   Dim x, y
         x="cd": y="bcd"
         comp=strcomp(x,y)
         msgbox comp                   'O/P:  1
Ex9:

Dim str1, str2
str1="QTP"
str2="qtp"

Msgbox StrComp(str1, str2)      '-1
Msgbox StrComp(str1, str2, 0)  '-1
Msgbox StrComp(str1, str2, 1)  '0

str1="qTP"
str2="Qtp"

Msgbox StrComp(str1, str2)      '1
Msgbox StrComp(str1, str2, 0)  '1
Msgbox StrComp(str1, str2, 1)  '0

str1="QTP"
str2="QTP"
Msgbox StrComp(str1, str2)      '0


15) String: Returns a string that contains a repeating character of a specified length

16) StrReverse: Reverses a given string.

Ex1:     x=dog
           Msgbox UCase(strReverse(x))  O/P: GOD

Ex1:     x=strreverse ("dabaraedyh")
           msgbox x            'O/P: hydearabad
                                   
Ex2:    Dim val,x
          val="Hyderabad"
          x=StrReverse(val)
          msgbox x             ' O/P:  dabaredyH  
                                   
Ex3:    val="001"
          x=StrReverse(val)
          msgbox x             ' O/P:  100
                            
Ex5:    val=#10-10-10#
          x=StrReverse(val)
          msgbox x             'O/P: 0102/01/01

3. Array Functions:

3) Array Functions: Array     Filter    IsArray   Join    LBound      Split    UBound 

1) Array: Returns a variant containing an array
Ex1:     Dim A               
           A=Array("hyderabad","chennai","mumbai")
           msgbox A(0)                                             O/P  hyderabad
           ReDim A(5)
           A(4)="nellore"                                          
           msgbox A(4)                                             O/P  Nellore

Ex2:    var = array(100, "india","#22-05-2012#")
           msgbox var(0)                                          O/P: 100
           msgbox var(1)                                          O/P: india
           msgbox var(2)                                          O/P: #22-05-2012#

2) Filter
Returns a zero-based array that contains a subset of a string array based on a filter criteria

3) IsArray: It checks weather the given variable is an array or not. It returns a Boolean value.

Ex1: 

Dim var1, var2, x
var1 = Array("Hyderabad", "Chennai", "Nellore")
x= IsArray(var1)
msgbox x                  O/P: True
x=isArray(var2)
msgbox x                  O/P: False


Ex2: 

Dim a
Msgbox IsArray(a)       'False
a= Array("India",100, 100.345, #10/10/2011#)
Msgbox IsArray(a)       'True
Msgbox a(1) '100

Ex3: 

Dim a, b(3), c(), d(3,4)
Msgbox IsArray(a)       'False
Msgbox IsArray(b)       'True
Msgbox IsArray(c)       'True

Msgbox IsArray(d)      'True


4) Join: Returns a string that created by joining a number of substrings in an array.

Ex1:           

Dim mystring, myarray(3)
      myarray(0)="Ananda "
      myarray(1)="Rao "
      myarray(2)="Mahesh"
      mystring=Join(MyArray)
      msgbox mystring                 O/P: Ananda Rao Mahesh

5) LBound: Returns the smallest subscript for the indicated dimension of an array
6) UBound: Returns the largest subscript for the indicated dimension of an array
Ex1:     Dim x(3), y(4,5)
           Msgbox Lbound(x) '0
           Msgbox UBound(x) '3

          'Find size of the Array

           Msgbox UBound(x)+1  '4
           Msgbox Lbound(y,1)   '0
           Msgbox Lbound(y,2)   '0
           Msgbox UBound(y,1)  '4
           Msgbox UBound(y,2)  '5


7) Split:  To returns a zero-based, one-dimensional array contains a specified number of substrings.

Ex1:          s = "open 4 record"
                msgbox  s                                       O/P: open 4 record
                arr = split(s , " ")
                msgbox arr(0)                                  O/P: open  
                msgbox arr(1)                                  O/P: 4 
                msgbox arr(2)                                  O/P: record

                msgbox join(arr," ")                          O/P: open 4 record


Ex2:     Dim a, b, x
           b = "VB Script is a Powerful scipting language"
           a=Split(b, " ")

           x=IsArray(b)
           msgbox x

          x=IsArray(a)
           msgbox x

           msgbox a(6)

Ex3:    Dim a, b, x
          b = "VB,Script,is,a,Powerful,scripting,language"
          a=Split(b, ",")

          msgbox a(5)                   O/P  scripting

Ex4:    Dim a, b, x
          b = "VB@Script@is@a@Powerful@scipting@language"
          a=Split(b, "@")

          msgbox a(5)                     O/P  scripting

Ex5     Dim a, b, x
           b = "VB Script is a Powerful scripting language"
           a=Split(b)

           msgbox a(5)                    O/P  scripting

Ex6      Dim a, b, x
           b = "VBScriptisaPowerful sciptinglanguage"
           a=Split(b)

           msgbox a(5)           O/P: script out of range error


Ex7:

Dim val, x
val="VB Script Language"
Msgbox IsArray(x)             'False

x=Split (val)
Msgbox IsArray(x)             'True
Msgbox x(1)                      'Script

val="VB@Script@Language"
x=Split (val,"@")
Msgbox x(0)                     'Script


val="VB@#Script@#Language"
x=Split (val,"@#")
Msgbox x(2)                    'Language

Ex8:

Dim val, x, y
val="abcde@gmail.com"
x=Split(val,"@")
y=Split (x(1),".")
Msgbox x(0)                  'abcde
Msgbox y(0)                 'gmail

Msgbox y(1)                 'com


4. Date and Time Functions:


4) Date and Time Functions: CDate   DateAdd     DateDiff     DatePart    DateSerial 
      DateValue      Day      FormatDateTime      Hour      IsDate      Minute    Month   
      MonthName      Second     Timer     TimeSerial    TimeValue    Weekday 
      WeekdayName     Year     Date   Time   Now

1) CDate: Converts a valid date and time expression to the variant of subtype Date
               Date Returns the current system date

2) DateAdd: Returns a date to which a specified time interval has been added

3) DateDiff: Returns the number of intervals between two dates. (day / month)
                 The following examples subtract date1 from date2 complete d, m, y.

 Ex1:   Dim Date1, Date2, x

          Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("yyyy", Date1, Date2)
          Msgbox x         
                         'Difference in Years         O/P: 2

Ex2:     Date1=#10-10-09#
           Date2=#10-10-11#
           x=DateDiff("q", Date1, Date2)
           Msgbox x     
                         'Difference in Quarters      O/P: 8

Ex3:    Date1=#10-10-09#
           Date2=#10-10-11#
           x=DateDiff("m", Date1, Date2)  ' m for month
           Msgbox x      
                        'Difference in Months      O/P: 24

Ex4:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("w", Date1, Date2)
          Msgbox x       
                      'Difference in weeks        O/P: 104

Ex5:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("d", Date1, Date2)  ' d for day   
          Msgbox x        
                      'Difference in days         O/P: 730

                 Dim myday
                 mydate=#02-17-2009#
                 x=Datediff("d",mydate,Now)
                 msgbox x


Ex6:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("y", Date1, Date2)  ' it considers days only   
          Msgbox x     
                         'Difference in days        O/P: 730
  
Ex7:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("h", Date1, Date2)
          Msgbox x      
                         'Difference in Hours     O/P: 17520

Ex8:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("n", Date1, Date2)
          Msgbox x      
                 'Difference in Minutes     O/P: 1051200

Ex9:   Date1=#10-10-09#
          Date2=#10-10-11#
          x=DateDiff("s", Date1, Date2)
          Msgbox x     
                'Difference in Seconds    O/P: 63072000

Ex10:   Date1=#10-10-09#
           Date2=#10-10-11#
           x=DateDiff("y", Date1, Date2)
           Msgbox x    
                  'Difference in day of years     O/P: 730

Ex11:  Date1=#10-10-09#
           Date2=#10-10-11#
           x=DateDiff("a", Date1, Date2)
           Msgbox x           
                      'Error     O/P: Invalid Procedure call

Ex12:  Date1=#10-10-09#
           Date2=#10-10-11#
           x=DateDiff(Date1, Date2)
           Msgbox x           'Error     O/P: Invalid Procedure call
        
Ex13:   Dim d, m, y
           Date1=#10-10-09#
           Date2=#10-10-11#
           d=DateDiff("d", Date1, Date2)  ' d for day   
           m=DateDiff("m", Date1, Date2)  ' m for months   
           y=DateDiff("yyyy", Date1, Date2)  ' yyyy  for years   
           msgbox  y  &space(5) &m &space(5) & d  
                                             ‘Output:  2  24 730   

Ex14:

Dim Date1, Date2

Date1=#10/10/2010#
Date2=#10/10/2012#

Msgbox DateDiff ("d", Date1, Date2) &" Days"                  '731 Days
Msgbox DateDiff ("yyyy", Date1, Date2) &" Years"            '2 Years
Msgbox DateDiff ("q", Date1, Date2) &" Quarters"            '8 Quarters
Msgbox DateDiff ("w", Date1, Date2) &" Weeks"              '104 Weeks        
Msgbox DateDiff ("m", Date1, Date2) &" Months"             '24 Months
Msgbox DateDiff ("h", Date1, Date2) &" Hours"                '17544 Hours    
Msgbox DateDiff ("n", Date1, Date2) &" Minutes"             '1052640 Minutes
Msgbox DateDiff ("s", Date1, Date2) &" Seconds"            '63158400 Seconds


4) DatePart: Returns the specified part of a given date

5) DateSerial: Returns the date for a specified year, month, and day

6) DateValue: Returns a date

7) Day: Returns a number that represents the day of the month (between 1 and 31, Inclusive)

Ex1:     Dim myday
           myday=Day("17,December,2009")
           msgbox myday                                O/P: 17

Ex2:    Dim myday
          mydate=date
          myday=Day(Mydate)
          msgbox myday           ‘today date is 17 may 2012:                                               O/P: 17

8) FormatDateTime: Returns an expression formatted as a date or time

9) Hour: Returns a number that represents the hour of the day (between 0 and 23,
               inclusive)          

Ex1:  Dim mytime, Myhour
         mytime=Now
         myhour=hour (mytime)
         msgbox myhour               ‘now time is 11:19 PM- O/P: 23         

10) IsDate: It checks weather the given value is Date type data or not.  It returns
                   a boolean value.

Ex1:        Dim myDate , x
               myDate = 100
               x = IsDate(myDate)
               msgbox x                        O/P: False

Ex2:        myDate = "india"
               x=IsDate(myDate)
               msgbox x                        O/P: False

Ex3:        myDate = #10/05/2010#
               x=IsDate(myDate)
               msgbox x                         O/P: True

Ex4:       myDate = #10-05-2010#
              x=IsDate(myDate)
              msgbox x                          O/P: True
                         
Ex5:       myDate = #01-06-12#
              x=IsDate(myDate)
              msgbox x                          O/P: True

Ex6:       myDate = 01-06-2012
              x=IsDate(myDate)
              msgbox x                          O/P: False

Ex:

Msgbox IsDate("India")                  'False
Msgbox IsDate(100)                      'False
Msgbox IsDate(100.345)                 'False
Msgbox IsDate(#10-10-10#)            'True
Msgbox IsDate(#10-10-2010#)          'True
Msgbox IsDate(#10/10/2010#)           'True
Msgbox IsDate(#Sep-10-2010#)          'True
Msgbox IsDate(#December-10-2010#) 'True
Msgbox IsDate(#13/10/2010#)            'True

Msgbox IsDate(#13/13/2010#)           'Error


11) Minute: Returns a number that represents the minute of the hour (between 0 and 59, inclusive)

12) Month: Returns a number that represents the month of the year (between 1 and 12, inclusive)

13)MonthName: Returns the name of a specified month

14) Now: Returns the current system date and time

Ex1:    msgbox now          O/P : 6/1/2012 1:56:45 AM

15) Second: Returns a number that represents the second of the minute (between 0 and 59, inclusive)

16) Time: Returns the current system time Or
               Returns a Variant of subtype Date indicating the current system time. 



Ex1:    Dim mytime
           mytime=Time
           msgbox mytime          O/P : 11:40:03 PM

17) Timer: Returns the number of seconds since 12:00 AM (midnight)

Ex1:


Function myTime(N)
Dim StartTime, EndTime

StartTime = Timer
    For I = 1 To N
    Next
EndTime = Timer

myTime= EndTime - StartTime
msgbox myTime
End Function

Call myTime(2000)               O/P: 7.609863

Ex2:

Var1=Timer

SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"

Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4ecdb9b8782b45abd52fe0071501985aefa77c16"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close

var2=timer

Msgbox var2-var1

18)TimeSerial: Returns the time for a specific hour, minute, and second

19)TimeValue: Returns a time

20) Weekday: Returns a number that represents the day of the week
                       (between 1 and 7, inclusive)

Ex1:     msgbox weekday("01-06-2012")         O/P :  6
           msgbox weekday(#June 01, 2012#)   O/P :   6
           msgbox weekday(#July 01, 2012#)     O/P : 1

21)WeekdayName: Returns the weekday name of a specified day of the week

Ex1:    msgbox weekdayname(weekday("01-06-2012"))          O/P: Friday 
           msgbox weekdayname(weekday(#June 01, 2012#))   O/P: Friday  
           msgbox weekdayname(weekday(#July 01, 2012#))    O/P: Sunday

22) Year: Returns a number that represents the year

23) Date: Returns the current system date        

Ex:     Dim mydate
          mydate=Date
          msgbox mydate    Output:  5/21/2012


Date Manipulation Examples:

' show todays date
MsgBox Date

' show the time
MsgBox Time

' show both the date and time
MsgBoxNow

' calculate the minimum Date of Birth for someone who is 18 years old
strMinDoB = DateAdd("yyyy", -18, Date)
MsgBox strMinDob

' show the number of years difference between strMinDob and today
MsgBox DateDiff("yyyy", strMinDob, Date)

' show the hour portion of the time
MsgBox DatePart("h", Time)

' show the day portion of the date
MsgBox Day(strMinDob)

' show the month portion of the date
MsgBox Month(strMinDob)

' show the year portion of the date
MsgBox Year(strMinDob)

' show the weekday portion of the date
' Sunday=1, Monday=2, --> Saturday=7 
MsgBox WeekDay(strMinDob)

Note: Acceptable 'Interval' parameters for DatePart, DateAdd and DateDiff...

"yyyy" = Year
"q" = Quarter
"m" = Month
"y" = Day of year
"d" = Day
"w" = Weekday
"ww" = Week of year
"h" = Hour
"n" = Minute
"s" = Second



msgbox Date                     '17-Mar-14
msgbox Time                     '07:07:53 PM
msgbox Now                      '17-Mar-14  07:08:13 PM

msgbox Date &" "&Time       '17-Mar-14  07:08:38 PM
msgbox Time &" " &Date      '07:09:04  PM 17-Mar-14

Time: Returns the current system time Or
               Returns a Variant of subtype Date indicating the current system time. 



Ex1:    Dim mytime
           mytime=Time
           msgbox mytime          O/P : 11:40:03 PM

Now: Returns the current system date and time



Ex1:    msgbox now          O/P : 6/1/2012 1:56:45 AM



5. Math Functions:

5) Math Functions: Abs   Atn   Cos   Exp   Hex   Int   Fix  Log   Oct   Rnd   Sgn   Sin   Sqr
  Tan   Round

1) Abs: Returns the absolute value of a given number
Ex1:     Dim num
           num=abs(-50.33)
           msgbox num          O/P: 50.33

Ex2:     Dim num
           num = 157.67
           num=abs(num)
           msgbox num           O/P: 157.67

Note: It provide only positive value


2) Atn
Returns the arctangent of a specified number
3) Cos
Returns the cosine of a specified number (angle)
4) Exp
Returns e raised to a power
5) Hex
Returns the hexadecimal value of a specified number
6) Int
Returns the integer part of a specified number
7) Fix
Returns the integer part of a specified number
8) Log
Returns the natural logarithm of a specified number
9) Oct
Returns the octal value of a specified number
10) Rnd
Returns a random number less than 1 but greater or equal to 0
11) Sgn
Returns an integer that indicates the sign of a specified number
12) Sin
Returns the sine of a specified number (angle)
13) Sqr
Returns the square root of a specified number
14) Tan
Returns the tangent of a specified number (angle)
15) Round: It is used for round the value of a given value. Or
                   Returns a number, rounded to a specified number of decimal places.
          Note: if the decimal point above .5 it returns next nearest value
                   If the decimal point below .5 it returns before integer value.

Ex1:      Dim num
             num=172.499
             num=Round(num)
             msgbox num                 O/P: 172

Ex2:      x = 123.45678
             Msgbox round(x,2)          O/P: 123.46

Ex3:      Dim num, x
             num=14.49
             x=Round(num)
             msgbox x                        O/P: 14

Ex4:      Dim num, x
             num=14.59
             x=Round(num)
             msgbox x                        O/P  15

Ex5:      Dim num, x
             num="14.49"
             x=Round(num)
             msgbox x                       O/P  14

Ex6:      Dim num, x
             num="Hyd"
             x=Round(num)

             msgbox x     O/P: Type mismatch Error

Ex7:      Msgbox Round(100.45)     '100
            Msgbox Round(100.65)      '101

            Msgbox Round(-100.45)    '-100
            Msgbox Round(-100.65)    '-101


6) Format Functions: FormatCurrency     FormatDateTime     FormatNumber
FormatPercent

1) FormatCurrency:  Returns an expression formatted as a currency value
2) FormatDateTime: Returns an expression formatted as a date or time
3) FormatNumber: 
Returns an expression formatted as a number
4) FormatPercent

Returns an expression formatted as a percentage


                           
7) I/O Functions: InputBox     MsgBox

1) InputBox: Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents of the text box.

Dim Input
Input = InputBox("Enter your name")
MsgBox ("You entered: " & Input)

2) MsgBox: Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked.

Dim MyVar
MyVar = MsgBox ("Hello World!", 65, "MsgBox Example")


8. Other Functions:


8) Miscellaneous Functions Or Other Functions: CreateObject     Eval      GetLocale      GetObject
        GetRef     IsEmpty      IsNull      IsNumeric      IsObject     LoadPicture     RGB     ScriptEngine       
        ScriptEngineBuildVersion       ScriptEngineMajorVersion      ScriptEngineMinorVersion       SetLocale   
        TypeName      VarType

1) CreateObject:      Creates an object of a specified type

Set objExcel = CreateObject("Scripting.FileSystemObject")

‘Creates and returns reference of the FileSytemObject to an Automation object. It can be used for performing operations on computer file system

Set objExcel = CreateObject("Excel.Application")

'Creates and returns reference of the Excel object to an Automation object. It can be used for performing operations on Spreed sheet (Ms-Excel files)

Set objWord = CreateObject("Word.Application")

'Creates and returns reference of  the Word Object to an Automation object. It can be used for performing operations on Ms-Word documents

Set objConnection = CreateObject("ADODB.Connection")

'Creates and returns reference of the Database Connection to an Automation object. It can be used for Connecting, opening and Closing databases

Set objRecordSet = CreateObject("ADODB.Recordset")

'Creates and returns reference of the Database Recordset to an Automation object. It can be used for performing operations on database tables (Records)

Set objPPT = CreateObject("PowerPoint.Application")

'Creates and returns reference of the Ms-Power point object to an Automation object. It can be used for performing operations on Power point presentations

Set xmldoc = WScript.CreateObject("msxml2.domdocument")



'Creates a Data Base Object for executing the Stored Procedure

Set objcmd = CreateObject("ADODB.Command")

 ‘Create a common dialog object for File Browser

Set objDialog = CreateObject("MSComDlg.CommonDialog”)

‘Create a shell object for Create shortcut folder on desktop or run the dos command

Set objShell = CreateObject("WScript.Shell")

‘Create a Dictionary Object

Set objDict  = CreateObject("Scripting.Dictionary")

‘Create Description objects used to locate that objects available or not ex: check box

Set objDescription = Description.Create()


‘Create an object for our new library after create the .DLL file in vb5/6

Set objDLL  = CreateObject("QTP.Library")

‘Create a qtp object

Set objQTP  = GetObject("","QuickTest.Application")

‘Create a Network Object for computer name

Set objNet  = CreateObject("WScript.NetWork")

‘Create the shell object for service running or not

Set objShell=CreateObject("Shell.Application")


CreateObject Function

Syntax: Set variable=CreateObject("Class value")

Examples:

'Create File System Object
Dim objFso
Set objFso=CreateObject("Scripting.FileSystemObject")

'Create Excel application Object
Dim objExcel
Set objExcel=CreateObject("Excel.Application")

'Create Word Application Object
Dim objWord
Set objWord=CreateObject("Word.Application")

'Create Database connection Object
Dim objConnection
Set objConnection=CreateObject("Adodb.Connection")

'Create Database Recotdset Object
Dim objRecordset
Set objRecordset=CreateObject("Adodb.Recordset")

'Create Database Command Object
Dim objCommand
Set objCommand=CreateObject("Adodb.Command")

'Create Dictionary Object
Dim objDict

Set objDict=CreateObject("Scripting.Dictionary")


2) Eval: Evaluates an expression and returns the result
         
Ex1:
Sub GuessANumber
   Dim Guess, RndNum
   RndNum =  2 * 100
   Guess = CInt(InputBox("Enter your guess:",,0))
   Do
      If Eval("Guess = RndNum") Then
         MsgBox "Congratulations! You guessed it!"
         Exit Sub
      Else
         Guess = CInt(InputBox("Sorry! Try again.",,0))
      End If
   Loop Until Guess = 0
End Sub
    
GuessANumber          O/P : excute upto guess no is 200


3) GetLocale: Returns the current locale ID

4) GetObject: Returns a reference to an automation object from a file

5) GetRef: Allows you to connect a VBScript procedure to a DHTML event on your pages

6) IsEmpty: Returns a Boolean value that indicates whether a specified variable has been initialized or not

Ex:

Dim x
Msgbox IsEmpty(x) 'True

x=0

Msgbox  IsEmpty(x) 'False


7) IsNull: Returns a Boolean value that indicates whether a specified expression contains no valid data (Null)

8) IsNumeric: It checks weather the given value is numeric or not and it returns a Boolean value True/False like result.

Ex1.   Dim MyVar, MyCheck
         MyVar = 53
         MyCheck = IsNumeric(MyVar)
        msgbox MyCheck                              O/P : True
        MyVar = "459.95"
        MyCheck = IsNumeric(MyVar)            O/P : True
        msgbox MyCheck
        MyVar = "45 Help"
        MyCheck = IsNumeric(MyVar)
        msgbox MyCheck                               O/P : True                                   

Ex2.  x=isnumeric("India")
        msgbox x                              O/P : False

Ex3:

Msgbox IsNumeric("India")            'False
Msgbox IsNumeric(100)                'True
Msgbox IsNumeric(100.345)          'True
Msgbox IsNumeric("100")              'True
Msgbox IsNumeric("100.45")          'True
Msgbox IsNumeric(#10/10/2010#)  'False
Msgbox IsNumeric(#Sep-10-2010#) 'False

Msgbox IsNumeric("1234*56")        'False

9) IsObject
 Returns a Boolean value that indicates whether the specified expression is an automation object
10) LoadPicture
Returns a picture object. Available only on 32-bit platforms

11) RGBReturns a number that represents an RGB color value

12) ScriptEngineReturns the scripting language in use
13) ScriptEngineBuildVersion
Returns the build version number of the scripting engine in use
14) ScriptEngineMajorVersion
Returns the major version number of the scripting engine in use
15) ScriptEngineMinorVersion
Returns the minor version number of the scripting engine in use
16) SetLocale
Sets the locale ID and returns the previous locale ID
17) TypeName
Returns the subtype of a specified variable

18) VarType: It checks the data type or                     
Returns a value that indicates the subtype of a specified variable
         
Ex1:      Dim x, y
             x=100
             y=VarType(x)
             Msgbox y             'O/P :  2 (Integer) 
                                     
Ex2:      x="Hyderabad"
             y=VarType(x)
             Msgbox y             ‘O/P :  8 (String) 

Ex2:      val="100.456"
             y=VarType(val)
             Msgbox y             ‘O/P :  8 (String) 

Ex3:     x=#10-10-10#
           y=VarType(x)
           Msgbox y               ‘O/P : 7 (Date format)

Ex4:    x=100.56
           y=VarType(x)
           Msgbox y               'O/P : 5 (Double)

Ex5:    y=VarType(a)
          Msgbox y               'O/P : 0 (Empty) for Uinitialized

Ex6:    Set x =CreateObject("Scripting.FileSystemObject")
           y=VarType(x)
           Msgbox y              'O/P : 9(Automation Object)

Important Functions: Abs, Array, Asc, Chr, CInt, Date, Day, DateDiff, Hour, Join, InStr, Eval, Time, VarType, Left, Right, Len, Mid, Timer, isNumeric, Inputbox, Msgbox,  CreateObject, Round, StrReverse, strComp, Replace, Instr, LBound, UBound

No comments

Post a Comment