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

What are the steps involved in recovery scenario wizard?

0 Answers  


Hi cud you plz answer my question.. what is the size of Object Repository?

8 Answers   TCS,


How to get line numbers in your editor in expert view?

1 Answers  


How to identify whether a web page exists or not without using Browser(" ").Page(" ").Exist?

1 Answers  


Hi friend I have query regarding QTP datatable. I want to insert data in datatable during runtime. suppose i wrote datatble.value(1) = "Test data" so when i run the script it says column(1) doesn't exist. Then i write something in column A1 manualy and run the script again. Now it works fine. Pls clarify how i can put value in blank cell of datatable.

10 Answers   Apex,


which checkpoint we use to validate yahoo login screen window after login with ur id and password in qtp

8 Answers   Covansys,


Explain in brief about the QTP Automation Object Model.

0 Answers   Crea,


Without integrating QC/Testdirector with QTP, is it possible to keep track of the defects?If yes how? How to export QTP results to an excel sheet?

0 Answers  


what is the difference between quality and testing ?

2 Answers  


descriptive program for a yahoo mail that is in yahoo mail suppose check box mailid subject assume it is like this format all things are in webtable the question is suppose some mail ids are there in that mailids i want to select the check box wich is before a@gmail.com and after that i want to click on delete button

0 Answers   DigiTech,


How we can merge the object repositories?say if we have 2 or 3 object repositories then how we can merge them?Is there any option in QTP to merge the object repositories?

2 Answers  


How to connect to oracle(sqlserver) database to QTP

3 Answers   CTS,


Categories