TXlsFile provides the functions GetMacroData and SetMacroData.
How can I add a VBA code snippet using these functions?
Sorry, but sadly modifying VBA code is not a feature that we plan to implement in FlexCel at least in middle term. The main issue is that the code in an Xls or Xlsx file is stored as VBA bytecode, not text, so in order to allow you to read or write code snippets, we would have to implement a full VBA compiler and decompiler to convert between VBA bytecode and text, and from text to VBA bytecode.
Right now a VBA compiler is outside the scope of FlexCel: it would increase the code in an order of magnitude and add very little functionality.