Go Premium for a chance to win a PS4. Enter to Win


Cannot enter table caption text in Word protected document

Posted on 2016-08-31
Medium Priority
Last Modified: 2016-09-01
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?
Question by:Roger Hardy
  • 3
  • 3
LVL 76

Expert Comment

ID: 41778559
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?

Author Comment

by:Roger Hardy
ID: 41778624
Protection code:

 'select the two document Sections for Process Owners to edit
 With ActiveDocument
     Selection.Editors.Add wdEditorEveryone
     Selection.Editors.Add wdEditorEveryone
 End With

 'protect the rest of the document
 ActiveDocument.Protect Password:="XXXXX", NoReset:=False, Type:=wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=True

Author Comment

by:Roger Hardy
ID: 41778626
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.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 76

Expert Comment

ID: 41779694
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.
LVL 76

Accepted Solution

GrahamSkan earned 2000 total points
ID: 41779956
The code itself turns out to be quite simple:
Sub InsertCaption()
    Dim dlg As Word.Dialog

    With ActiveDocument
        If .ProtectionType = wdAllowOnlyReading Then
            .Unprotect ', password
        End If
        Set dlg = Application.Dialogs(wdDialogInsertCaption)
        .Protect wdAllowOnlyReading, True ',password
    End With
End Sub

Open in new window


Author Closing Comment

by:Roger Hardy
ID: 41780015
That worked.  Thank you!

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…
This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question