if the excel sheet specified in script is not there,we get
run time error how to handle the error ,please anybody
explain me in detail

Answers were Sorted based on User's Feedback



if the excel sheet specified in script is not there,we get run time error how to handle the error ..

Answer / rayudu

Use on error resume next

Is This Answer Correct ?    3 Yes 1 No

if the excel sheet specified in script is not there,we get run time error how to handle the error ..

Answer / veeranki naveen

On error resume Next
err.clear
set Excl = createobject("excel.application")
set Workbook=Excl.Workbooks.open("C:\Folder\ExcelFile.xls")
if err.number <> 0 then
msgbox "Excel Sheet is not present at the specified path"
End If


OR


set fso = createobject ("scripting.filesystemobject")

bol = fso.fileexists ("C:\Folder\ExcelFile.xls")

if bol = false then

msgbox "Excel Sheet is not present at the specified path"

End If

msgbox

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

how do you invoke the application through QTP?

1 Answers  


In web page there is five OK buttons available, while recording i click on 3rd OK button, How QTP identify the 3rd OK button while running script? Is qtp identify 3rd ok button?

14 Answers   Polaris,


What is smart identification?

2 Answers   Ordain Solutions,


How we can call the scripit from another scripit in QTP?,Not a call Action

12 Answers  


How to measure transaction time through VBScript without using start and end transaction points?

0 Answers  






Which scripting language used by QTP?

1 Answers  


what is On Error Resume Next ?

4 Answers   Accenture,


How can i count "spaces" in any sentence or a string if suppose " It is a Testing question" Here we have 4 gaps(spaces) Is there any function to find out spaces between words

5 Answers   iGate, Livetek,


How do u write a regular expression for date (dd/mm/yyyy) field ?

4 Answers   Semantic Space,


What is descriptive.create () in QTP?

3 Answers  


Define QTP ?

10 Answers   TCS,


Is it possible to call out to Java from QTP?

2 Answers  


Categories