Can someone tell me why
1. This code only changes the bookmark text the first time the selection is made but not if the user changes the selection thereafter?
2. My document is set up as section protected for the first section only (to enable the dropdowns and checkboxes), but I have to directly tell it in the code to unprotect the doc in order for the macro to not error with the indication that the macro could not be run because the doc was protected?
Code:Sub StatusM() ' If the value of the dropdown is "single" then the areas ' in the document that this should populate will also include ' the text " person" Dim vStatSelect As Integer Dim vStat As String vStatSelect = ActiveDocument.FormFields("Status").DropDown.Value Select Case vStatSelect Case 2 vStat = "single person" Case 3 vStat = "widow" Case 4 vStat = "widower" End Select If ActiveDocument.ProtectionType <> wdNoProtection Then ActiveDocument.Unprotect End If Selection.GoTo What:=wdGoToBookmark, Name:="StatusP" Selection.Delete Unit:=wdCharacter, Count:=1 Selection.InsertAfter vStat ActiveDocument.Bookmarks.Add Range:=Selection.Range, _ Name:="StatusP" Selection.GoTo What:=wdGoToBookmark, Name:="Status" ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True End Sub




Reply With Quote