SilverSN95
03-15-2011, 12:59 PM
Hey,
I'm having an issue with a Word form-field dropdown that may or may not be VBA related, but I'm hoping someone might know what is going on.
KECoverage_Exit() is called from a form-field dropodown, "KECoverage" on Exit. This macro then changes the value of two other dropdowns.
These other dropdowns also normally update a text field when changed, so the "Call Thing3(/4)_Exit" calls update those fields for the dropdown values that were changed.
All of this works the way I would like, EXECPT for the fact that Word crashes every so often when the user is changing the dropdown value. It seemed like clicking/tabbing more quickly than normal caused the problem, but occasionally just going through slowly would cause the error. Other times I can't even reproduce the error.
I guess what I'm asking is, does this sound like an error with the macro/form field combination, or is this just an error with Word?
Thanks.
Public Sub Thing3_Exit()
With ActiveDocument.FormFields.Item("Thing3")
If .DropDown.Value = 1 Then
ActiveDocument.FormFields.Item("Thing3W").Result = " blahblahblah "
ElseIf .DropDown.Value = 2 Then
ActiveDocument.FormFields.Item("Thing3W").Result = " blahblahblah "
Else
ActiveDocument.FormFields.Item("Thing3W").Result = " "
End If
End With
End Sub
Public Sub Thing4_Exit()
With ActiveDocument.FormFields.Item("Thing4")
If .DropDown.Value = 1 Then
ActiveDocument.FormFields.Item("Thing4W").Result = "blahblahblah"
ElseIf .DropDown.Value = 2 Then
ActiveDocument.FormFields.Item("Thing4W").Result = " blahblahblah"
Else
ActiveDocument.FormFields.Item("Thing4W").Result = " "
End If
End With
End Sub
Public Sub KECoverage_Exit()
With ActiveDocument.FormFields.Item("KECoverage")
If .Result = " blahblahblah 2" Then
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 2
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 2
Call Thing3_Exit
Call Thing4_Exit
ElseIf .Result = " blahblahblah 1" Then
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 1
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 1
Call Thing3_Exit
Call Thing4_Exit
Else
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 3
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 3
Call Thing3_Exit
Call Thing4_Exit
End If
End With
End Sub
I'm having an issue with a Word form-field dropdown that may or may not be VBA related, but I'm hoping someone might know what is going on.
KECoverage_Exit() is called from a form-field dropodown, "KECoverage" on Exit. This macro then changes the value of two other dropdowns.
These other dropdowns also normally update a text field when changed, so the "Call Thing3(/4)_Exit" calls update those fields for the dropdown values that were changed.
All of this works the way I would like, EXECPT for the fact that Word crashes every so often when the user is changing the dropdown value. It seemed like clicking/tabbing more quickly than normal caused the problem, but occasionally just going through slowly would cause the error. Other times I can't even reproduce the error.
I guess what I'm asking is, does this sound like an error with the macro/form field combination, or is this just an error with Word?
Thanks.
Public Sub Thing3_Exit()
With ActiveDocument.FormFields.Item("Thing3")
If .DropDown.Value = 1 Then
ActiveDocument.FormFields.Item("Thing3W").Result = " blahblahblah "
ElseIf .DropDown.Value = 2 Then
ActiveDocument.FormFields.Item("Thing3W").Result = " blahblahblah "
Else
ActiveDocument.FormFields.Item("Thing3W").Result = " "
End If
End With
End Sub
Public Sub Thing4_Exit()
With ActiveDocument.FormFields.Item("Thing4")
If .DropDown.Value = 1 Then
ActiveDocument.FormFields.Item("Thing4W").Result = "blahblahblah"
ElseIf .DropDown.Value = 2 Then
ActiveDocument.FormFields.Item("Thing4W").Result = " blahblahblah"
Else
ActiveDocument.FormFields.Item("Thing4W").Result = " "
End If
End With
End Sub
Public Sub KECoverage_Exit()
With ActiveDocument.FormFields.Item("KECoverage")
If .Result = " blahblahblah 2" Then
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 2
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 2
Call Thing3_Exit
Call Thing4_Exit
ElseIf .Result = " blahblahblah 1" Then
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 1
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 1
Call Thing3_Exit
Call Thing4_Exit
Else
ActiveDocument.FormFields.Item("Thing3").DropDown.Value = 3
ActiveDocument.FormFields.Item("Thing4").DropDown.Value = 3
Call Thing3_Exit
Call Thing4_Exit
End If
End With
End Sub