SlideShare a Scribd company logo
1 of 37
VB Script 12/29/10 For more QTP Scripts, www.ramupalanki.com
[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
VBScript Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Lifetime OF Variables ,[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Variable (Cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Constants ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Arrays ,[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Arrays (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Arrays (cont.) ,[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Procedures ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Procedures (Cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Procedures (Cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Functions (Cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
If Condition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
If-Else Condition ,[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
If-Else Condition (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
If-Elseif Condition (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Select Case Condition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
For Loop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
For Loop (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
For Loop (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Do-while loop ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Do-while loop (cont.) ,[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Do-Until Loop  ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Do-Until Loop (cont.) ,[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Built in Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],12/29/10 For more QTP Scripts, www.ramupalanki.com
Practical Work ! 12/29/10 For more QTP Scripts, www.ramupalanki.com
Thank You ! 12/29/10 For more QTP Scripts, www.ramupalanki.com

More Related Content

What's hot

Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)James Titcumb
 
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Igalia
 
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Simon Caplette
 
Security testing with gauntlt
Security testing with gauntltSecurity testing with gauntlt
Security testing with gauntltJames Wickett
 
Claire protorpc
Claire protorpcClaire protorpc
Claire protorpcFan Robbin
 
GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsDaniel Ilunga
 
Clk-to-q delay, library setup and hold time
Clk-to-q delay, library setup and hold timeClk-to-q delay, library setup and hold time
Clk-to-q delay, library setup and hold timeVLSI SYSTEM Design
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Dr. Maamoun Ahmed
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...Masashi Shibata
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014Hiroshi SHIBATA
 
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleBringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleAmbassador Labs
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Aljoscha Krettek
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerKoichi Sakata
 

What's hot (19)

Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
 
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...
 
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
 
Security testing with gauntlt
Security testing with gauntltSecurity testing with gauntlt
Security testing with gauntlt
 
Claire protorpc
Claire protorpcClaire protorpc
Claire protorpc
 
GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programs
 
Nug2004 yhe
Nug2004 yheNug2004 yhe
Nug2004 yhe
 
Wavedigitech gdb
Wavedigitech gdbWavedigitech gdb
Wavedigitech gdb
 
Clk-to-q delay, library setup and hold time
Clk-to-q delay, library setup and hold timeClk-to-q delay, library setup and hold time
Clk-to-q delay, library setup and hold time
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
 
ZeroMQ with NodeJS
ZeroMQ with NodeJSZeroMQ with NodeJS
ZeroMQ with NodeJS
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
MLOps Case Studies: Building fast, scalable, and high-accuracy ML systems at ...
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014
 
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleBringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 
Programming
ProgrammingProgramming
Programming
 

Similar to Qtpvbscripttrainings

7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtpBharath003
 
Copy of qtp presentation
Copy of qtp presentationCopy of qtp presentation
Copy of qtp presentationRamu Palanki
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script TrainingsAli Imran
 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+orderRamu Palanki
 
Copyofqtppresentation 101229032428-phpapp01
Copyofqtppresentation 101229032428-phpapp01Copyofqtppresentation 101229032428-phpapp01
Copyofqtppresentation 101229032428-phpapp01abu12345
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]srikanthbkm
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp BookG.C Reddy
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtpCuong Tran Van
 
Kotlin programming language
Kotlin programming languageKotlin programming language
Kotlin programming languageDSCMESCOE
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuningprathap kumar
 
Algorithm2e package for Latex
Algorithm2e package for LatexAlgorithm2e package for Latex
Algorithm2e package for LatexChris Lee
 
Introduction to LAVA Workload Scheduler
Introduction to LAVA Workload SchedulerIntroduction to LAVA Workload Scheduler
Introduction to LAVA Workload SchedulerNopparat Nopkuat
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPANdaoswald
 

Similar to Qtpvbscripttrainings (20)

7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtp
 
Copy of qtp presentation
Copy of qtp presentationCopy of qtp presentation
Copy of qtp presentation
 
Qtp presentation
Qtp presentationQtp presentation
Qtp presentation
 
Qtp presentation
Qtp presentationQtp presentation
Qtp presentation
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
 
Copyofqtppresentation 101229032428-phpapp01
Copyofqtppresentation 101229032428-phpapp01Copyofqtppresentation 101229032428-phpapp01
Copyofqtppresentation 101229032428-phpapp01
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
 
Kotlin programming language
Kotlin programming languageKotlin programming language
Kotlin programming language
 
Vbs
VbsVbs
Vbs
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
 
Qtp presentation
Qtp presentationQtp presentation
Qtp presentation
 
Algorithm2e package for Latex
Algorithm2e package for LatexAlgorithm2e package for Latex
Algorithm2e package for Latex
 
Test automation
Test automationTest automation
Test automation
 
Introduction to LAVA Workload Scheduler
Introduction to LAVA Workload SchedulerIntroduction to LAVA Workload Scheduler
Introduction to LAVA Workload Scheduler
 
Matopt
MatoptMatopt
Matopt
 
Final requirement
Final requirementFinal requirement
Final requirement
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
 

More from Ramu Palanki

Qtp sample certification questions and answers
Qtp sample certification questions and answersQtp sample certification questions and answers
Qtp sample certification questions and answersRamu Palanki
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scriptsRamu Palanki
 
Qtp questions and answers
Qtp questions and answersQtp questions and answers
Qtp questions and answersRamu Palanki
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginnersRamu Palanki
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questionsRamu Palanki
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answersRamu Palanki
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3Ramu Palanki
 
Qtp complete guide for all
Qtp complete guide for allQtp complete guide for all
Qtp complete guide for allRamu Palanki
 
Qtp compare two xml files
Qtp compare two xml filesQtp compare two xml files
Qtp compare two xml filesRamu Palanki
 
Qtp change excel cell color with condition
Qtp change excel cell color with conditionQtp change excel cell color with condition
Qtp change excel cell color with conditionRamu Palanki
 
Qtp certification questions
Qtp certification questionsQtp certification questions
Qtp certification questionsRamu Palanki
 
Qtp certification questions and tutorial
Qtp certification questions and tutorialQtp certification questions and tutorial
Qtp certification questions and tutorialRamu Palanki
 
Qtp certification questions2
Qtp certification questions2Qtp certification questions2
Qtp certification questions2Ramu Palanki
 
Qtp automation estimation techniques
Qtp automation estimation techniquesQtp automation estimation techniques
Qtp automation estimation techniquesRamu Palanki
 
Qtp 11 new enhacements in
Qtp 11 new enhacements inQtp 11 new enhacements in
Qtp 11 new enhacements inRamu Palanki
 
Qtp passing parameters between actions
Qtp passing parameters between actionsQtp passing parameters between actions
Qtp passing parameters between actionsRamu Palanki
 
Qtp wsh scripts examples
Qtp wsh scripts examplesQtp wsh scripts examples
Qtp wsh scripts examplesRamu Palanki
 

More from Ramu Palanki (20)

Qtp sample certification questions and answers
Qtp sample certification questions and answersQtp sample certification questions and answers
Qtp sample certification questions and answers
 
Qtp realtime scripts
Qtp realtime scriptsQtp realtime scripts
Qtp realtime scripts
 
Qtp questions and answers
Qtp questions and answersQtp questions and answers
Qtp questions and answers
 
Qtp material for beginners
Qtp material for beginnersQtp material for beginners
Qtp material for beginners
 
Qtp interview questions
Qtp interview questionsQtp interview questions
Qtp interview questions
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
 
Qtp interview questions3
Qtp interview questions3Qtp interview questions3
Qtp interview questions3
 
Qtp complete guide for all
Qtp complete guide for allQtp complete guide for all
Qtp complete guide for all
 
Qtp compare two xml files
Qtp compare two xml filesQtp compare two xml files
Qtp compare two xml files
 
Qtp change excel cell color with condition
Qtp change excel cell color with conditionQtp change excel cell color with condition
Qtp change excel cell color with condition
 
Qtp certification questions
Qtp certification questionsQtp certification questions
Qtp certification questions
 
Qtp certification questions and tutorial
Qtp certification questions and tutorialQtp certification questions and tutorial
Qtp certification questions and tutorial
 
Qtp certification questions2
Qtp certification questions2Qtp certification questions2
Qtp certification questions2
 
Qtp best tutorial
Qtp best tutorialQtp best tutorial
Qtp best tutorial
 
Qtp basic stuff
Qtp basic stuffQtp basic stuff
Qtp basic stuff
 
Qtp automation estimation techniques
Qtp automation estimation techniquesQtp automation estimation techniques
Qtp automation estimation techniques
 
Qtp 11 new enhacements in
Qtp 11 new enhacements inQtp 11 new enhacements in
Qtp 11 new enhacements in
 
Qtp sample resume
Qtp sample resumeQtp sample resume
Qtp sample resume
 
Qtp passing parameters between actions
Qtp passing parameters between actionsQtp passing parameters between actions
Qtp passing parameters between actions
 
Qtp wsh scripts examples
Qtp wsh scripts examplesQtp wsh scripts examples
Qtp wsh scripts examples
 

Qtpvbscripttrainings

Editor's Notes

  1. A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value. In VBScript, all variables are of type variant , that can store different types of data. 
  2. ************** Code for Variable ************************** Option Explicit Dim var_x var_x=1 msgbox("Value in X is:" &var_x) ************** Code for Constant ************************ Const x=20 msgbox("The Constant value is: " & x)
  3. ******* Code of Single Dimensional Array ********************* Dim names(2) names(0)="Mahboob" names(1)="Adeel" names(2)="Usman" msgbox("Array 0 Index Value is:" &names(0)) msgbox("Array 1st Index Value is:" &names(1)) msgbox("Array 2nd Index Value is:" &names(2)) ******* Code of Multi Dimensional Array ********************* Dim Two_Dim(1,1) Two_Dim(0,0) = "first row first column" Two_Dim(0,1) = "first row second column" Two_Dim(1,0) = "second row first column" Two_Dim(1,1) = "second row second column" msgbox(" Values in the row: " & Two_Dim(0,0) & " - " & Two_Dim(0,1) & " - " & Two_Dim(1,0) & " - " & Two_Dim(1,1) )
  4. Dim num1,num2,result Sub add() num1= 10 num2 = 20 result=num1 + num2 msgbox ("The Result is:" & result) End Sub Call add()
  5. ********** Code for Procedure without Arguments ******************** To be performed on QTP. Example is already created in QTP Dim num1,num2,result Sub add() num1= 10 num2 = 20 result=num1 + num2 msgbox ("The Result is:" & result) End Sub Call add() *********** Code for Procedure With Arguments ********************** Dim arg1,arg2,result Sub add(arg1,arg2) result=arg1 + arg2 msgbox("The Result for Passed Values in procedure is:" & result) End Sub call add (30,20) *********** Code for Procedure With Arguments ( after user Input)********************** Dim input1,input2,result input1=inputbox("Please Enter First Value") input2=inputbox("Please Enter Second Value") Sub addition(input1,input2) result=int(input1)+int(input2) msgbox("The Result is:" & result) End Sub Call addition(input1,input2)
  6. ' *********************Creating a Function without Arguments********************************** Function addition() Dim val1,val2,result val1=50 val2=50 result=val1+val2 addition=result End Function msgbox("The Result is:" &addition)
  7. ********** Code for Function without Arguments ******************** Function addition() Dim val1,val2,result val1=50 val2=50 result=val1+val2 addition=result End Function msgbox("The Result is:" &addition) ********** Code for Function with Arguments ************************************** Function addition(val1, val2) Dim result result =val1 + val2 addition =result End Function Dim temp temp = addition(5,7) msgbox("Result of addition: " & temp) ********** Code for Function with Arguments by getting User Input ******************** Dim arg1,arg2 arg1=inputbox("Please enter first value: ") arg2=inputbox("Please enter second value: ") Function addition(val1, val2) Dim result result =int(val1) + int(val2) addition =result msgbox("Result of addition: " & addition) End Function addition arg1,arg2
  8. **********************Code for simple If condition******************* Dim user_input user_input = inputbox("Enter any value less than 10 to execute If statement code ") If user_input < 10 Then msgbox("Code in if statement is executed......!") End If
  9. ************************* Code for If - Else condition ******************************** Dim user_input user_input = inputbox("Please enter value (if condition will execute incase entered value is less than 10) : " ) If user_input<10 Then msgbox ("IF statement executed") else msgbox ("Else statement executed") End If ************************* Code for If - Else condition********************************** Dim user_input user_input = inputbox("Please enter value (if condition will execute incase entered value is less than 10) : " ) If user_input<10 Then msgbox ("IF statement executed") else msgbox ("Else statement executed") End If ************************* Code for If – Elseif-Else condition***************************** Dim user_input user_input = inputbox("Please Enter Value to be comapred with 10 : " ) If user_input<10 Then msgbox ("IF statement executed") elseif user_input=10 then msgbox ("ElseIF statement executed") else msgbox("Else Statement is Executed") end if
  10. ************************* Code for Select Case ******************************** Dim user_input user_input=inputbox("Please Enter Payment Method i.e. Check/Cash/CC") Select Case user_input case "Check" msgbox("You Entered Check") Case "Cash" msgbox("You Entered cash") Case "CC" msgbox("you entered Credit Card") Case Else msgbox("Payment method not recognized") End Select
  11. ************************* Code For Loop******************************** Dim i For i=0 to 10 msgbox ("Loop Iteration is:" &i) Next ****************** Code for For Loop with step keyword******************************** Dim i For i=20 to 10 step -2 msgbox ("Loop Iteration is:" &i) Next ****************** Code for For Loop with Each Keyword******************************** Dim var Dim arr(2) arr(0)="Ali" arr(1)="Naseer" arr(2)="Adeel“ For each var in arr msgbox("The Stored value in Array was:" & var) Next
  12. ************************* Code Do-While Loop******************************** Dim x x=20 Do while x >10 msgbox("Value in X is Less Greater than: 10") x=x-1 Loop /***************************Do –While (condition in end)*************************** Dim x x=20 Do msgbox("Value in X is Less Greater than: "&x) x=x-1 Loop while x >10 /******************************** Do Until Loop**************************************** ' Code for do - until loop Dim x x= 30 Do until x < 20 msgbox("Value in X is:" & x) x=x-1 Loop /************************* Code for do-until loop (condition in the end) ***************************** Dim x x= 30 Do msgbox("Value in X is:" & x) x=x-1 Loop until x < 20
  13. ************************* Built In functions ******************************** **************** System date ********************************************* 'msgbox("Today's date(mm/dd/yyyy): "& date) **************** System time ********************************************* 'msgbox("Today's date(mm/dd/yyyy): "& time) *************** random number generated between 0 and 1 ******************** 'For i=0 to 10 'msgbox("Random Number: " & rnd ) 'Next **************** Search occurrence of In String from the full string **************************** 'Dim full_string,search_string,result 'full_string = inputbox("Enter the complete string: ") 'search_string = inputbox("Search string value: ") 'result = InStr(full_string,search_string) 'msgbox("Full String: "&full_string&chr(13)&"Search string: "&search_string&chr(13)& "Search string value: "&result)