The password is incorrect

S

Skrewdriver1979

Sub OnExitLLStates()
Select Case ActiveDocument.FormFields("State").Result
Case "OH"
ActiveDocument.Unprotect

ActiveDocument.Bookmarks("LLStatesVehicle").Range.Fields(1).Result.Text =
"(Text larger then 265 characters)"
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Case "MO"
ActiveDocument.Unprotect

ActiveDocument.Bookmarks("LLStatesVehicle").Range.Fields(1).Result.Text =
"(Text larger then 265 characters)"
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Case "OH" or "MO" is a dropdown located in Section 1 of the document

The text that is changed by selecting "OH" or "MO" is located in Section 7
of the form.

However, when I 'Protect Document' and tab out of the dropdown, I get the
following popup.

Microsoft Visual Basic
The password is incorrect

I have attempted to uncheck Section 7 in the 'Selection Sections...' however
the error still occurs.

The reason I am using 'Protect Document' instead of just locking the form is
there is a section that is 100% open to edit.

How can I or can I fix this error and still have the dropdown edit the text
field
 
S

Skrewdriver1979

Thanks in advance anyways. With enough trial and error, I think I got it.

Case "MO"
ActiveDocument.Unprotect Password:="password"

ActiveDocument.Bookmarks("LLStatesVehicle").Range.Fields(1).Result.Text =
"Text larger the 256 characters"
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="password"
 
S

Skrewdriver1979

After a lot of trial and error, I think I got it.

Case "MO"
ActiveDocument.Unprotect Password:="password"

ActiveDocument.Bookmarks("LLStatesVehicle").Range.Fields(1).Result.Text =
"Text longer then 256 characters"
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="password"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top