MESSAGE(FORMAT(CurrForm.Control.VISIBLE));For some reason the property value in this case will be the same as before user changed it by hiding the column. The only known way for me is to reopen this Form - then all the properties get their updated values. But this way is not suitable for current task wich is to show appropriate columns during exporting to Excel according to their visibility.
Comments
I don't know of any API to check the zup file to get this information though, that would be really nice.
This is not possible to solve with a combination of triggers, it's really annoying, similar to no trigger generated by clicking on a tab (that is however possible to workaround).
All I can think of is that you modally run your form from another object (codeunit or invisible form) giving it (the form with the tablebox) a function to check from the object that runs it to find out whether the user canceled/closed the window or clicked on your button (or whatever) to export (both would close the window - you button or whatever setting the variable the function would return and then doing a CurrForm.CLOSE). This would then be checked from the object that opened the form and if the user selected to export, the object that run the form clear the form variable, call another new function to say en export is in progress (the variable this sets would be checked in OnOpenForm) and then modally run the form again. Now the property would be updated and OnOpenForm could perform the export if the variable was set to true.
Madness I know, but it would work, and I cannot think of another way to do it.
Run T2.