Is it possible to add VB to Excel worksheet from POI?

Does anyone know if it is possible to add VB to an Excel document from inside Java? I basically want to add a pivot table in a worksheet and dynamically set some of its properties. I know that I can access the pivot table settings from VB, but not directly from the POI.

+4
source share
1 answer

I did something similar where I pre-created a table with VBA using Excel. Then I load it using the POI, fill in the values ​​and then save them again. This way I get a table with filled values ​​and pre-configured VB / macros, etc.

Perhaps you need to create your VBA in advance, and it will read its dynamic properties from the worksheet. You can then fill in these properties as you wish.

+7
source