Here's the doc that has all of the text that the macro needs to produce. The years (1790-1940) are in a drop-down menu. The regular non-conditional form fields are the grey highlighted ones. There are 6 conditional form fields depending on the chosen year highlighted in yellow. There is one conditional drop-down menu (AorB).
What is done-
The year drop-down. All of the text and conditional text. All of the bookmarks for the conditional form fields.
What I need help on-
The conditional form fields and the one conditional drop-down menu.
Here is the drop-down exit macro which I am assuming where the additional code needs to go. I have tried to write it and failed miserably.
Code:
Sub LockDD1()
'
' Exit macro
'
'
Dim Prot As Variant, BmkRng As Range
Const BmkNm As String = "Column" ' The bookmark name
With ActiveDocument
Prot = .ProtectionType
If .ProtectionType <> wdNoProtection Then
Prot = .ProtectionType
.Unprotect Password:=Pwd
End If
If .Bookmarks.Exists(BmkNm) Then
Set BmkRng = .Bookmarks(BmkNm).Range
If .FormFields("DD1").Result = "1790" Then
.FormFields.Add BmkRng, wdFieldFormTextInput
BmkRng.FormFields(1).TextInput.EditType wdRegularText, "X,"
Else
BmkRng.Delete
End If
.Bookmarks.Add BmkNm, BmkRng
Else
MsgBox "Bookmark: " & BmkNm & " not found."
End If
.Protect Type:=Prot, NoReset:=True
End With
Set BmkRng = Nothing
Application.ScreenUpdating = False
If ActiveWindow.View.Type = wdPageView Then
ActiveWindow.ActivePane.View.Type = wdNormalView
Else
ActiveWindow.View.Type = wdPageView
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Then
ActiveWindow.ActivePane.View.Type = wdPageView
Else
ActiveWindow.ActivePane.View.Type = wdNormalView
End If
End Sub
BTW kudos to you and being self taught-I too am self taught but at least a couple of light-years behind-Thanks