>>myWord = CreateObject("Word.Application") >>**** do a Mail merge >>**** close all additional Word Windows as Main Document & DataSource >>DO WHILE FindWindow(0, "MicroSoft Word - Form Letters") # 0 && But "that caption now is varying :o((( >> DO EVENTS >>ENDDO >>>
>*... >If llToPrinter > oWatcher = CreateObject('myTimer', oWordDocument) >Else > oWatcher = CreateObject('myTimer2', oWordDocument) >EndIf >*... > >Define Class myTimer As Timer > Interval = 1000 > oWord = .null. > > Procedure init > Lparameters toWord > this.oWord = toWord > endproc > > Procedure Timer > With this.oWord > If .BackgroundPrintingStatus > 0 && Wait printing to finish > Return > Endif > For Each oDoc In .Documents > oDoc.Close(wdDoNotSaveChanges) > Endfor > oDoc = .Null. > .Quit(wdDoNotSaveChanges) > EndWith > this.Enabled = .F. > Clear Events > Endproc >Enddefine > >Define Class myTimer2 As Timer > Interval = 1000 > oWord = .null. > > Procedure init > Lparameters toWord > this.oWord = toWord > endproc > > Procedure Timer > If Type('this.oWord.Visible') = 'L' and this.oWord.Visible > Return > endif > this.Enabled = .F. > Clear Events > Endproc >Enddefine >>Cetin