- Public WithEvents App As Word.Application
- Private Sub App_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)
- With Doc.Tables(1)
- For Each c In .Range.Cells
- If Len(c.Range) = 3 Then
- a = MsgBox("表格填写不完整,确定要退出吗?", vbYesNo)
- If a = vbNo Then
- Cancel = True
- c.Range.Select
- End If
- Exit For
- End If
- Next
- End With
- End Sub