Link to home
Start Free TrialLog in
Avatar of Roger Hardy
Roger Hardy

asked on

Cannot enter table caption text in Word protected document

Designed a protected document in Word with sections that everyone can edit.  Other sections are locked/protected.

Working in the unprotected sections, the user can enter anything, including a table or figure.  But, when the user tries to enter a caption, the Caption message box will not allow user to make content entry in the "Caption" field.  The caption field does get populated with the correct section number and table number, i.e. "10-1", but the user cannot add anything further.  An error message asserts saying "This is not a valid selection."  If I unprotect the entire document, no troubles entering user content into the caption field via the message box.

Oh...another thing.  if the user just accepts the caption label provided, e.g. Table 10-1, and selects OK on the message box, the caption is appropriately placed in the document - which if fine.  At this point, further text can be added to the caption.

I'm guessing it has something to do with that the caption label contains hidden bookmarks.  

I have other macros that I have written to temporarily unlock and then relock the document.  Is there a way to do this for this problem?
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

It will save asking  many questions if you could post a sample document (redacted if necessary).

Some of the questions are:

What sort of protection?
By section, do you mean a Word document Section, or just block of text?
What type of field is the caption field?
Avatar of Roger Hardy
Roger Hardy

ASKER

Protection code:

 'select the two document Sections for Process Owners to edit
 With ActiveDocument
     .Bookmarks("ChangeHistory").Range.Select
     Selection.Editors.Add wdEditorEveryone
     .Sections(4).Range.Select
     Selection.Editors.Add wdEditorEveryone
 End With

 'protect the rest of the document
 ActiveDocument.Protect Password:="XXXXX", NoReset:=False, Type:=wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=True
The Caption is not a field.  Its from "Insert Caption" option on the menu of options found by right clicking on the crossed arrow icon that appears near the top left corner of a selected table.

The table is not in the protected portion of the document.
OK, Gottit now.

I can reproduce the problem (in Word 2007), so I suppose that it is a bug. However Word 2003 works properly.

In view of the fact that the cursor is automatically placed after the SEQ field just where the typed-in text would go, It might not be worth the creating a special macro.

The method would probably involve the macro having  the same name as the Word command that opens the dialogue, This would run instead of the Word command. In it, the code would turn off protection, display the dialogue and restore the protection after the dialogue is dismissed.

It would take some research to determine the correct command and dialogue.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked.  Thank you!