Micro Focus QTP (UFT) Forums
Object required 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Object required error (/Thread-Object-required-error)



Object required error - Brian - 06-19-2008

Hi guys,

Im trying to use the inStr function to check a variable (vClose) that has been read into my script from an external excel sheet.

The following piece of code -
Code:
searchString = "/"
Dim tmpVar

If (tmpVar = inStr (1,vClose, searchString, CompareMethod.Text) = 1) then
......
else
....
End If

Im getting an "Object required" error message. anyone know why this is occurring?

Thanks,
Brian


RE: Object required error - Ankur - 06-19-2008

where did u get this CompareMethod.Text from?

Also, i don't understand the way you have put (=) comparison operator

Correct syntax would be:

Code:
vclose = "22/32/45" //As an ex

searchString = "/"

Dim tmpVar

tmpVar =  inStr (1,vClose, searchString, 1) //1 for text comparison

If (tmpVar  = 3) then

msgbox tmpVar

else
...
End If