Solved

Cannot enter table caption text in Word protected document

Posted on 2016-08-31
6
124 Views
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?
0
Comment
Question by:Roger Hardy
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
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?
0
 

Author Comment

by:Roger Hardy
ID: 41778624
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
0
 

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.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 76

Expert Comment

by:GrahamSkan
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.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 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)
        dlg.Show
        .Protect wdAllowOnlyReading, True ',password
    End With
End Sub

Open in new window

0
 

Author Closing Comment

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

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This video Micro Tutorial is the first 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 al…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 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