There is a WindowSelectionChange event in Word VBA that you can use. It is described in the Word VBA help file in the "Using Events with the Application Object" section.
The trick is to assign your application a variable in the class module (I named my EventClassModule) using the WithEvents keyword:
Public WithEvents App As Word.Application
Then in your normal document open event, you can initialize the variable in the current application:
Dim oEvents As New EventClassModule Private Sub Document_Open() Set oEvents.App = Word.Application End Sub
Back in the EventClassModule, you use the WindowSelectionChange event to check if the selection is a table:
Private Sub App_WindowSelectionChange(ByVal Sel As Selection) If Sel.Information(wdWithInTable) And ThisDocument.ProtectionType = wdNoProtection Then ThisDocument.Protect wdAllowOnlyFormFields ElseIf ThisDocument.ProtectionType <> wdNoProtection Then ThisDocument.Unprotect End If End Sub
This code will be called whenever the cursor changes location. I tested it and it is a bit fictitious (the oEvents object tends to become uninitialized for some reason), but hopefully this will be the beginning for your solution.
Emily source share