junkmark
07-03-2007, 12:14 PM
I am creating a form in which the user makes a selection from a drop down menu with 5 options in it. I am using an exit macro to control text in an adjacent cell. Thus, the user selection in the dropdown menu determines what text will be output.
I have tried an If... Then, but after looking around on here, went with a Select Case. I used some examples I found here and I am able to output the correct text at the correct time and in the correct location.
The PROBLEM is that the user's selection from the drop down menu does not hold. In other words, the user selects option two, then tabs to the next form field, and in doing so the appropriate text is displayed, but the dropdown menu RESETS to the first option.
I have tried a million things and I am still pretty new to this all, so please help (and please be gentle if i am doing something stupid). Thank you so much!
Here is what I have:
Sub SpecialProgramOption()
Set Doc = ActiveDocument
If Doc.ProtectionType <> wdNoProtection Then Doc.Unprotect
Dim ProgramOptions()
Dim var
Dim i As Integer
Dim POValue As Integer
ProgramOptions = Array("<Special Programs Option>", "Hessen Global", "Formal Internship", "IUSP Marburg", "European Studies, Frankfurt")
POValue = ActiveDocument.FormFields("DropDown7").DropDown.Value
Select Case ActiveDocument.FormFields("DropDown7").DropDown.ListEntries.Item(POValue).Name
Case "<Special Programs Option>"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "Hessen Global"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(combined summer course work and internship)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "Formal Internship"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(please follow the Hessen Networks Link below, click on 'Incomings' and link to the 'Hessen/Wisconsin Internship Program' for additional information and application procedures: link goes here)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "IUSP Marburg"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(International Undergraduate Study program, Semester or Academic Year)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "European Studies, Frankfurt"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(4 weeks, early summer)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
End Select
End Sub
My brain hurts...
I have tried an If... Then, but after looking around on here, went with a Select Case. I used some examples I found here and I am able to output the correct text at the correct time and in the correct location.
The PROBLEM is that the user's selection from the drop down menu does not hold. In other words, the user selects option two, then tabs to the next form field, and in doing so the appropriate text is displayed, but the dropdown menu RESETS to the first option.
I have tried a million things and I am still pretty new to this all, so please help (and please be gentle if i am doing something stupid). Thank you so much!
Here is what I have:
Sub SpecialProgramOption()
Set Doc = ActiveDocument
If Doc.ProtectionType <> wdNoProtection Then Doc.Unprotect
Dim ProgramOptions()
Dim var
Dim i As Integer
Dim POValue As Integer
ProgramOptions = Array("<Special Programs Option>", "Hessen Global", "Formal Internship", "IUSP Marburg", "European Studies, Frankfurt")
POValue = ActiveDocument.FormFields("DropDown7").DropDown.Value
Select Case ActiveDocument.FormFields("DropDown7").DropDown.ListEntries.Item(POValue).Name
Case "<Special Programs Option>"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "Hessen Global"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(combined summer course work and internship)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "Formal Internship"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(please follow the Hessen Networks Link below, click on 'Incomings' and link to the 'Hessen/Wisconsin Internship Program' for additional information and application procedures: link goes here)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "IUSP Marburg"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(International Undergraduate Study program, Semester or Academic Year)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
Case "European Studies, Frankfurt"
With ActiveDocument.Tables(2).Cell(Row:=7, Column:=2).Range
.Delete
.InsertAfter Text:="(4 weeks, early summer)"
End With
With ActiveDocument
.Protect wdAllowOnlyFormFields
End With
End Select
End Sub
My brain hurts...