How to see the information of {PRIVATE} Field Codes

Hi,

I have used {PRIVATE} Field Codes for hidden my Answers in Question paper word file. Now I want to see again the answer information in {PRIVATE} field codes.

Please help me to get the value of {PRIVATE} field codes.

by

jaidinesh

Press Alt+F9 and the private fields will display.
________________________________
Richard V. Michaels
info@greatcirclelearning.com
Provides AuthorTec add-ins for Mac & Win-Office. Site: greatcirclelearning.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Microsoft describes the { PRIVATE } field succinctly:

The Private field stores data for documents converted from other file formats. Microsoft Word inserts a Private field when converting file formats; the field contains data needed for converting a document back to its original file format.

I suspect that you would have to convert back to the original format to display its content.

If you have included text in a private field of your own construction then you would need to display hidden text to reveal that structure. Hopefully you have not released the questions c/w these 'hidden' answers.

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

When you Alt-F9 to see the field code, you may also need to ensure that the option to display hidden text is checked. You can click the ¶ button in the ribbon, or go into Word -Options->Display.

Some field types can also store data in a Data area which is not displayed in your document. That is really how the PRIVATE and ADDIN fields were intended to be used. But you have to use VBA to use that facility to store and retrive text int he field, and it does not sound as if you have done so.


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Press Alt+F9 and the private fields will display.

hi,

yes we know Alt+F9 will display the {PRIVATE} syndex only, but I need what is the assigned value by someone in {PRIVATE}.

by

jaidinesh

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi,

I have created one character style: Strong for Answer indication. Then I had called that answer in styleRef field codes.

Now tell me how to call this "You can" in {PRIVATE} field codes? 

by

jaidinesh

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

As far as I can tell, the only way you can do that in modern versions of Word is to insert the "You can" in the field, so it looks like this:

{ PRIVATE You can }

You can do that by copying/pasting the text into the field.

But then it will be visible to anyone who can display hidden text. At one time (a long time ago) it was possible to associate data with PRIVATE, but I have been unable to do so in recent versions of Word. I can make the field an ADDIN field, then set the .Data property of the field, then change the field type to PRIVATE, but in that case, when you save the document as .docx I think the data is removed.

You could use an ADDIN field instead, hide the field (they are not hidden by default, like PRIVATE fields). It is worth bearing in mind that ADDIN fields are not actually supported by the Office Open XML standard (although they are still available in Word 2013). The field's data is encoded (base64 or some such) when the document is saved as .docx, which is some protection, but not a lot.

So you might be better off using an ADDIN field. You could insert one like this and store the selected text:

Sub selectionToHiddenAddinField()
Dim faddin As Word.Field
Dim raddin As Word.Range
Dim s As String
s = Selection.Text
Set raddin = Selection.Range
' we have to put the field somewhere. Here, it is at the end
' of the selection. Not a good place, as the presence of the
' ADDIN field will tell the user which option is the correct
' answer. Perhaps always store at the end of the answers.
raddin.Collapse direction:=WdCollapseDirection.wdCollapseEnd
raddin.Font.Hidden = True
Set faddin = raddin.Fields.Add(raddin, WdFieldType.wdFieldAddin, "", False)
faddin.Data = s
Set faddin = Nothing
Set raddin = Nothing
End Sub

and display the first addin found in the selection like this:

Sub showSelectedAddinFieldData()
Dim bAddinFound
Dim f As Word.Field
Dim s As String
bAddinFound = False
For Each f In Selection.Fields
  Debug.Print f.Type
  If f.Type = WdFieldType.wdFieldAddin Then
    bAddinFound = True
    s = f.Data
    If s = "" Then
      MsgBox "No data"
    Else
      MsgBox s
    End If
    Exit For
  End If
Next
If Not bAddinFound Then
  MsgBox "The Selection did not contain any ADDIN fields."
End If
End Sub

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 21, 2024 Views 1,546 Applies to: