Fixed logic so that Word will properly restart if a file has errors.

This commit is contained in:
Rich 2010-07-16 19:01:46 +00:00
parent ebd566dcb2
commit 952ef202c9

View File

@ -221,6 +221,8 @@ namespace DataLoader
{ {
try try
{ {
// RHM 20100628 - All of a sudden, this was null and would not work.
// I added the else clause so that the WinWord process would be terminated.
if (myWordDoc != null) if (myWordDoc != null)
{ {
WordDoc.CloseApp(); WordDoc.CloseApp();
@ -228,6 +230,13 @@ namespace DataLoader
while (WordDoc.WordProcesses.Length > 0) while (WordDoc.WordProcesses.Length > 0)
Application.DoEvents(); Application.DoEvents();
} }
else
{
WordDoc.KillWordApps();
Application.DoEvents();
while (WordDoc.WordProcesses.Length > 0)
Application.DoEvents();
}
} }
catch (Exception ex) catch (Exception ex)
{ {