c# - How to get the window handle for a VBA MsgBox? -
i'm running c# script on large number of excel workbooks involves calling macro in each workbook; macro produces msgbox because of error handler, , pauses execution of script until click "ok" in msgbox. the title text of msgbox "error in processsub", , main text "error (type mismatch)". i thought maybe have concurrent thread finds open windows, , if finds msgbox, clicks "ok". i'm trying find window using this: using system.diagnostics; public process geterrorwindow() { process[] processlist = process.getprocesses(); foreach (process process in processlist) { if (process.mainwindowtitle=="error in processsub") { return process; } } } but doesn't find anything. when through processlist[] , seems find main excel window, , not of child windows vba code produces. there way find msgbox , click ok button? you can us...