Update multiple field in Protected Restrict Editing Word Document

Anonymous
2020-07-03T10:30:58+00:00

Dear Sir,

I have word document which has multiple fields. We are using ASK field and LINK Excel.sheet.12 (for some data extract from Excel to Word). In my word document, there is also some Exceptions (for editing). Now my problem is

  1. How to update my all fields in protected Restrict Editing Word Document.
  2. I don't want to unprotect my document or share password to our users
  3. After updating all fields, user can enable to edit in Exceptions area only rest of other part must have unable to edit

Thanking You

Afzal

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

12 answers

Sort by: Most helpful
  1. Stefan Blom 357.7K Reputation points MVP Volunteer Moderator
    2020-07-08T21:21:38+00:00

    Which fields are you trying to update? A single line of code should do the trick:

    ActiveDocument.Fields.Update

    Which line in the macro generates the error?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2020-07-07T03:51:55+00:00

    How did you set the password? You mentioned Restrict Editing, so I assumed that you were referring to document protection applied via the Restrict Editing pane (Review > Restrict Editing). Here, the macro can run without supplying a password.

    If a password has been set for opening the document, you must specify that password as the document is opened, for example via the Documents.Open method.

    Hi Stefan,

    You are right, the password only for restrict editing (Review>Restrict Editing), but where is macro ? you missed paste macro for these.

    I am not using password for opening the document. there is no password for opening the document.

    Thanking You,

    Afzal

    Was this answer helpful?

    0 comments No comments
  3. Stefan Blom 357.7K Reputation points MVP Volunteer Moderator
    2020-07-06T20:11:13+00:00

    How did you set the password? You mentioned Restrict Editing, so I assumed that you were referring to document protection applied via the Restrict Editing pane (Review > Restrict Editing). Here, the macro can run without supplying a password.

    If a password has been set for opening the document, you must specify that password as the document is opened, for example via the Documents.Open method.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2020-07-06T05:02:18+00:00

    You can update fields with a macro even in a protected document. In its simplest form, the following line of code can be used:

    ActiveDocument.Fields.Update

    Depending on the needs of your document, something more sophisticated may be required, though.

    Dear Stefan Blom,

    As I said earlier, my word document has password and protected from editing except some exception in entire word document. I am using below codes for update my fields.

    Sub ChangeLinkPath()

        Dim rg As Range

        Set rg = ActiveDocument.Range

        rg.TextRetrievalMode.IncludeFieldCodes = True

        With rg.Find

            .Text = "<original path and file name>"

            .Replacement.Text = "<new path and file name>"

            .Execute Replace:=wdReplaceAll

        End With

        ActiveDocument.Fields.Update

    End Sub

    But whenever I execute this, it will showing run time "4605" error because of my word document is password protected. Can anyone have solution for this ?

    1. I want to update all fields in word document,
    2. All the fields have to update in password protected mode

    Thanking You,

    Afzal

    Was this answer helpful?

    0 comments No comments
  5. Stefan Blom 357.7K Reputation points MVP Volunteer Moderator
    2020-07-03T11:43:12+00:00

    You can update fields with a macro even in a protected document. In its simplest form, the following line of code can be used:

    ActiveDocument.Fields.Update

    Depending on the needs of your document, something more sophisticated may be required, though.

    Was this answer helpful?

    0 comments No comments