Post by JezebelYou can trap the Application.DocumentChange event, but your code will
have to be *extremely* efficient or you'll disrupt the user.
Don't you mean the WindowSelectionChange event?
The DocumenmtChange event is fired when documents are created, opened or
activated.
In any case, you are right about the "*extremely* efficient", and this will
be complex as well.
Or, you could highjack the built in cut/delete commands with a couple of
subs, this would be easier than implementing a class module and the
application event:
'_______________________________________
Sub EditCut()
If Selection.Information(wdWithInTable) Then
MsgBox "You can't delete tables."
Else
Selection.Cut
End If
End Sub
'_______________________________________
'_______________________________________
Sub EditClear()
If Selection.Information(wdWithInTable) Then
MsgBox "You can't delete tables."
Else
Selection.Delete
End If
End Sub
'_______________________________________
But, this is still complicated. For example, what if the user selects an
area of text that starts outside a table and finishes outside a able but
includes a table? That table will be deleted.
The code would have to be complete and thoroughly tested before being
distributed.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
***@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org