Humor me here. First, I'm not sure what the "windows window" is so you'll have to grant me a little latitude. I'm not quite sure what you are trying to do.
Usually, when I exit Word after an automation session, I simply return to Access, though by this point the procedure that instantiaited Word has completed, and my Word application variable is out of scope, destroyed. However, VBA is unavoidably single-threaded, so you can always halt code execution indefinitely by simply displaying some type of message box. As long as the message box is displayed, nothing else on the Access side can occur, absolutely nothing.
Your word app appears at the line:
.Visible=True
So immediately following:
.ActiveDocument.Bookmarks("one").Select
You could insert some code like:
Dim strMessageTitle As String
Dim strMessage As String
Dim intReturn As Integer
strMessageTitle = "Resume processing?"
strMessage = "Would you like to continue processing?"
intreturn = MsgBox(strMessage, vbYesNoCancel + _
vbQuestion + vbDefaultButton1, strMessageTitle)
Your Access VBA code will halt here. This message box won't appear over your word document. It will only exist in the Access process and won't effect the process Word is running in at all. When you close Word, you'll be back at Access, greeted by the message box asking you if you want to resume the execution of the code in your Access module. Its actually pretty unobtrusive.
Anyway, just a possible work-around that occurred to me.
HTH,
Bob
|