Solved

Cannot enter table caption text in Word protected document

Posted on 2016-08-31
6
69 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
Comment Utility
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
Comment Utility
That worked.  Thank you!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

PaperPort (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) is among the most important applications that I run on my Windows computers. I use it every day, for nearly all of my document and photo scanning, as well as most of my…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now