Double click to change a value


Enable a user to double-click text in a document to change its value

Use a macrobutton field. A macrobutton field is a placeholder that displays a value (such as "Y", "N", or "?") and can run a macro when you double-click it. The macro can do anything you want it to do, including change the displayed value.
Before creating the macrobutton, Create the macro which you want to run when the field is double-clicked. The following macro will exactly fit the needs described above:


Sub SymbolCarousel() 
Select Case Selection.Fields(1).Code.Characters(29)
  Case "Y"
    Selection.Fields(1).Code.Characters(29) = "N"
  Case "N"
    Selection.Fields(1).Code.Characters(29) = "?"
  Case "?"
    Selection.Fields(1).Code.Characters(29) = "Y"
  Case Else
End Select
End Sub

After creating the SymbolCarousel macro, create the macro button by positioning the cursor where you want the N/Y/? value displayed. Then press Ctrl+F9 to insert a set of field braces { }. (Don't just type the braces. You must insert them using Ctlr+F9.)
Within the braces, type very carefullly the exact character string shown between braces below (but don't type the braces). Be sure to leave a space before the word MACROBUTTON, before SymbolCarousel, and before N. Do NOT put a space after the N.


{ MACROBUTTON SymbolCarousel N }
Right-click the field expression and choose Toggle Field codes.


Double-click and see if the N changes to a ?. Double-click again and see if it changes to a Y. Again and it should change back to N.



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev