Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function error
#1
Not Solved
Hello,

I have a code in qtp as below:

PHP Code:
Dim FilePath 
FilePath 
"Template.xlsx"
Set ExcFile ExcelApp.Workbooks.Open (FilePath)
Set SheetOne ExcFile.Worksheets("HappyPath")
closeVB ''call the function 


I saved the function in the function library.
PHP Code:
Function closeVB

        
If VbWindow("vbname:=frmPrint").Exist Then
                                    SheetOne
.Cells(i+1,25) = "Yes"
                         
        
Else

                                         
SheetOne.Cells(i+1,25) = "No"
                        
        
End if 

End Function 

When I run qtp, I get error "object required:sheetone". Do I need to have sort of return in the function?

Please advise.

-S
Reply
#2
Not Solved
where do you mention path of the file
Reply
#3
Not Solved
Make sure that you have a sheet "HappyPath".
Thanks,
SUpputuri
Reply
#4
Not Solved
Path of the file exist in the main file.
HappyPath exist already. My script works fine if I have the function in the main file. It does not work if I keep the function in the library.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,769 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  Run Error on Function call in QTP essentials cnujonnala 1 2,196 12-31-2012, 02:38 PM
Last Post: krr
  How can I fetch server time using function Now or any other function? blanchedsouza 2 4,837 11-07-2009, 08:34 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 1 Guest(s)