Micro Focus QTP (UFT) Forums
function error - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: function error (/Thread-function-error)



function error - shipu - 01-04-2014

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


RE: function error - vinod123 - 01-04-2014

where do you mention path of the file


RE: function error - supputuri - 01-06-2014

Make sure that you have a sheet "HappyPath".


RE: function error - shipu - 01-06-2014

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.