Hi Guys
After dabbling with Excel VBA, I have now turned my attention to looking at word, and I hope that this will be an easy one to solve! Basically I want my checkbox to run the macro on a button click, not when it "enters" or "exists." The reason for this is my form works brillantly if the user was to tab across the fields, but when you check/uncheck boxes with a mouse it can be a little hit and miss with the macro firing. Can anyone assist? The code that runs is as below (basically the check box hides/unhides a form field)
Code
Sub Tradefile()
If ActiveDocument.FormFields("Check3").CheckBox.Value = False Then
ActiveDocument.Unprotect
ActiveDocument.FormFields("Input3").Range.HighlightColorIndex = wdWhite
ActiveDocument.FormFields("Input3").Range.Font.Color = wdColorWhite
ActiveDocument.FormFields("Input3").Enabled = False
Else
ActiveDocument.Unprotect
ActiveDocument.FormFields("Input3").Enabled = True
ActiveDocument.FormFields("Input3").Range.HighlightColorIndex = wdYellow
ActiveDocument.FormFields("Input3").Range.Font.Color = wdColorBlack
ActiveDocument.FormFields("Input3").Range.Select
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
Display More