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--4601) |
Object Required Error - sharmi84 - 03-24-2011 Hi Ankur, My task is to enable a checkbox of a required link. I've written the below code for accomplishing it. It worked well initially. Suddenly when i tried executing today it throws error at "workspace_chkbox.Click" and says "Object Required". Im confused on this coz it worked well before. Kindly help me on this. The code below is for you reference Code: Dim workspace_chkbox Thanks in Advance! Sharmila RE: Object Required Error - manishbhalshankar - 03-24-2011 Hi Sharmila, Always use "Option Explicit" as the first line of your code. This will throw error if there is any typo in variable name or if a variable is not defined. In your code you have used: Workspace_Check and workspace_chkbox. If Option Explicit is not there then both the variables are considered as one and the same. Check if the position of webcheckbox has changed in your application. RE: Object Required Error - basanth27 - 03-24-2011 Manish - That is not correct. Workspace_check and workspace_chkbox are different variables. Option Explicit is a good suggestion. Sharmila - The issue is with regards to either a shift in the location of the object or index. One of the ways i can suggest is to use On Error Resume next. Try this code, Code: Dim workspace_chkbox RE: Object Required Error - sharmi84 - 03-24-2011 Hi Manish, I tried option explicit and now i find it works. Thank you so much for your suggestion Sharmila |