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 frame work you are following?

1 Answers   Wipro,


Differenece betwen Project and product ? when company need project or product?

4 Answers   Accenture,


what is the difference betn QTP 8.0 AND PREVIOUS VERSION

1 Answers   BirlaSoft,


Syntax for how to call one script from another and Syntax to call one "Action" in another?

1 Answers   Crea,


What is exact difference between “while” and “do while” in QTP ?

1 Answers  


How can i check items sorted or not in a weblist ? Give me the script for this...

1 Answers  


what is the difference between function and subroutine ....here every one knows theoretically...here my QUESTION IS WHAT IS THE MEANING OF FUNCTION CAN RETURN A VALUE AND SUB CAN NOT RETURN A VALUE .....WHAT DOE'S IT MEAN FUNCTION CAN RETURN A VALUE HOW FUNCTION CAN AND SUB CAN'T ....GIVE A EXAMPLE FOR BOTH ....HOW IT CAN AND CAN NOT...HELP ANDY ONE....

1 Answers   HCL,


Explain about the Test Fusion Report of QTP?

1 Answers  


How will you test a stapler?

1 Answers  


Analyzing the Checkpoint results ?

1 Answers   Crea,


the question was on what techonlogy u been working on i said VB then he asked me the addin for VB in Qtp?

4 Answers   BirlaSoft,


If there are 10 notepads opened on desktop. how can we close a particular 2nd notepad using script

3 Answers  


Categories