I've written a script for verifying that selecting a menu in my application displays the correct content. However, after I select the menu items, focus jumps back to the main window and the mouse repositions itself at (presumably) 1,1 on that main window; problems arise when the automation accidentally clicks in that position, which opens another window.
As best I can tell, the repositioning occurs at the .attach command. Is there a way to attach to a window/dialog box without the mouse moving? I've tried stepping through my code, but its hard to see when the focus changes.

<font class="small">Code:</font><hr /><pre> For Each MenuNavigation_ExcelData_Row In MenuNavigation_ExcelData_ActiveData
IEWindow("application = IEXPLORE.EXE caption = 'AdvancedMD*'", tpAttachNoWait).Attach

'Select the menu options
HTMLSpan("InnerText = '" &amp; MenuNavigation_ExcelData_Row.GetString("Main Menu") &amp; "'").Click 'Main menu
HTMLTD("InnerText = '" &amp; MenuNavigation_ExcelData_Row.GetString("Sub Menu 1") &amp; "'").Click 'First sub-menu
If MenuNavigation_ExcelData_Row.GetString("Sub Menu 2") &lt;&gt; "" Then 'This could be blank
HTMLTD("InnerText = '" &amp; MenuNavigation_ExcelData_Row.GetString("Sub Menu 2") &amp; "'").Click 'Second sub-menu
End If

'Verify that the correct page is displayed
If IEWindow(MenuNavigation_ExcelData_Row.GetString("P age Name"), tpAttachNoWait).Exists = True Then
UserCheck "Menu Navigation", True, "The menu navigation was correct."
UserCheck "Page Title", True, "The correct page was displayed."
UserCheck "Page Title", False, "The correct page was NOT displayed. Expected: " &amp; MenuNavigation_ExcelData_Row.GetString("Page Name")
End If
Next </pre><hr />