.net – How to capture response from Cancel or Ok Button in two different Applications

vb.net

With my Application (vb.net) I am trying to scan Excel files some of which have ActiveX Components.

When running my Application, I am getting a pup-up window in Windows Vista Environment with Office-2007 having button OK and Cancel button to proceed.

But my problem is the scanning is not proceeding even after I keep on pressing the OK button. Now I want to continue with my application while pressing the Cancel button; i.e. just to skip the file. Is it possible to capture the response from the cancel button? (As this is a message box from another application, i.e. either from Vista or Office-2007, I'm not sure).

My main motive is to just ignore the message box to proceed….

Can anyone please help me out there….

Thank you….

Best Answer

The DisplayAlerts property of Microsoft.Interop.Excel.Application may help here.

If set to FALSE then Excel automatically chooses the default option on pop-up boxes. Whether or not this applies to ActiveX controls I don't know but it may be worth trying.

Related Topic