Micro Focus QTP (UFT) Forums
Unable to Click on Excel Dialog - 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: Unable to Click on Excel Dialog (/Thread-Unable-to-Click-on-Excel-Dialog)



Unable to Click on Excel Dialog - Raj20091 - 10-17-2009

Hello,
I am opening an excel and changing a value. When I change the value I get a dialog box(based on validations)

Code
Code:
Set objWorksheet1 = objWorkbook.Worksheets(2)
objWorksheet1.Cells(3,2) = "Oak"
Window("BM_269.xlsm").Dialog("Microsoft Excel").WinButton("OK").Click

The dialog box has focus but QTP is unable to click on the OK button. It doesn’t know the dialog exists. After I click OK manually everything runs fine.

Any suggestions?

Thanks,
Raj


RE: Unable to Click on Excel Dialog - jsknight1969 - 10-19-2009

the object in the repository is not unique enough to be identified, so you either need to add a unique property value like text to the object or use DP to identify it like this

Code:
Window("BM_269.xlsm").Dialog("Microsoft Excel").WinButton("text:=OK").Click

That should do it.


RE: Unable to Click on Excel Dialog - Raj20091 - 10-19-2009

Thanks for the response. The button is unique, that is the only button in the entire script. I think there is something happening with the macros, that is preventing QTP to get control.


RE: Unable to Click on Excel Dialog - jsknight1969 - 10-20-2009

If the Object Repsitory can "find the object" correctly, then I agree there is another reason. Can't imagine a Macro interfering with QTP clicking a button, but anything is possible.


RE: Unable to Click on Excel Dialog - basanth27 - 10-20-2009

Raj -
Check this Post it helps you.

Let us know the outcome.


RE: Unable to Click on Excel Dialog - Raj20091 - 10-20-2009

Thanks for the suggestion. That is a good approch.
That did not work for me. I will have to check with the developer to find out whats happening behind the scene.


RE: Unable to Click on Excel Dialog - berula - 03-15-2011

Hi Raj,
there are two ways:

First use Descriptive Progarmming to select the Dialog.
Or go to object repository an delete the test object details with name "is owned window" and "is child window" for the dialog.

ralf