Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?
I am explaining you the logic of the dismissing a Dialog Box displayed by an Office Application with Visual Basic. The Automation client calls the method PrintOut Word Document object. If the user's default printer is configured to print to the FILE port, a call to PrintOut generates a dialog box that prompts the user to type a file name. To determine if the PrintOut method causes this dialog box appears, the automation client Visual Basic uses a Timer control to detect idle time after calling the PrintOut method. Before calling PrintOut, Timer is enabled and set to break out in five seconds. When PrintOut completes, Timer is disabled. Therefore, if the PrintOut method completes within five seconds, the Timer event never occurs and there is no other action. The document is printed and the code execution continues beyond the PrintOut method. However, if the Timer event occurs within the five-second interval, it is assumed that the PrintOut method has not been completed and that the delay is due to a dialog that waits for user input data. When the Timer event occurs, the Automation client gives focus to Word and uses SendKeys to dismiss the dialog.
QTechnology Ultra-Quiet ATX PSU 460W I MSI K8N Neo4-F I AMD Opteron 144 CABNE0545 2.66Ghz I 2 x 512MB RAM I 380GB Maxtor SATAI Raid0 Hard Drive I 40GB Maxtor IDE Hard Drive I Nvidia GeForce 7900GTX I Win XP Home Service Pack 2 I Soundblaster Xtreme Fidelity Fatal1ty I Mercury Home Theater HT-4500
Bookmarks