You can use SetFocus() in an IF loop to wait for the particular window you need to SendKeys() to.

Or use the low-tech SLEEP to allow time for the windoow to appear. Down side of this is the user may pre-empt it with a NO.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.