If Then statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a pulldown field with two options the user can choose from.

I want a seperate sentence to say something specific based on option 1 from
the pulldown and another sentence to say something else baded on option 2.

Could someone give me direction on how to do this in Word if it even does
this? Can I expand this to allow >2 options?

I know how to do this in Excel, but not familiar with vba and coding.
 
Brw,

You could set an on exit macro to run from your drop down fiedl to set the
value of a text field. Something like this may work:

Sub OnExit()
Dim oDoc As Document
Dim mySelection As String

Set oDoc = ActiveDocument

mySelection = oDoc.FormFields("DropDown1").Result

Select Case mySelection
Case Is = "A"
oDoc.FormFields("Text1").Result = "Some sentence text"
Case "B"
oDoc.FormFields("Text1").Result = "Some other sentence text"
Case Else
MsgBox "All cells are in use."

End Select

End Sub

"A" and "B" are values in the dropdown field. You can expand to >2 options
by simply adding more Case statements.
 
Back
Top