Hi Armin,
Not sure if there's a better, "proper" way to do it.
If you don't find anything, you might try the code below which uses SendKeys
(yukk!) to cancel out of the message box that pops up. I posted it here last
week to a similar question.
Regards,
Klaus
Sub AutoClose()
Dim myDoc As Document
Set myDoc = ActiveDocument
Application.EnableCancelKey = wdCancelDisabled
If ActiveDocument.Saved = False Then
Select Case _
MsgBox("Do you want to save the changes?", _
vbQuestion + vbYesNoCancel, _
myDoc.Name)
Case vbYes
' Dialogs(750).Show
myDoc.Save
myDoc.Close
Case vbNo
myDoc.Saved = True
myDoc.Close
Case vbCancel
SendKeys "{ESC}"
End Select
Else
myDoc.Close
End If
Application.EnableCancelKey = wdCancelInterrupt
End Sub
> Hi Jezebel,
>
[quoted text clipped - 12 lines]
>
> Any further suggestions?
Armin Laschet - 25 Aug 2005 11:36 GMT
Hi Klaus,
thanx for your detailed suggestion. I was already given a hint to
SendKeys yesterday by someone who referred to your posting (I guess; hi
Helmut ;) ).
I will check it, when I'm home from work. But it looks pretty yukky to
me, too. Amazing, that there seems to be no clean way to do it.
Thought, that what I intend to do is just an everyday-task.
Have a nice day
Armin