Page 1 of 1

Add macro VBA (vbaProject.bin) possible ?

PostPosted: Sat Feb 27, 2016 11:31 pm
by demonx
Hi,

I'm trying (in Java) to create a Excel file (.xlsm) with personnals macro in VBA.
The macros must be generated by Java code.
Is this possible ?
Apache POI (HSSF and XSSF) has limiMacros
Macros can not be created. The are currently no plans to support macros. However, reading and re-writing files containing macros will safely preserve the macros.y preserve the macros.

We can add a macro in a package for a dotx (xlsx-java-f15/adding-macro-xlsm-package-t727.html#p2287)
I also saw this topic too : docx-java-f6/inserting-macros-t238.html But it's for a Word (dotx, docm) document

I know that it's possible to set a VBA Project (vbaProject.bin) with (Apache POI), but is it possible to generate a vbaProject.bin file ?
Or generete macro directly with Java code ?

Macros are different for each generated Excel file, so it's impossible to create Macro into an Excel model (.xltm)


Thank you in advance and have a nice day

Best regards

Re: Add macro VBA (vbaProject.bin) possible ?

PostPosted: Mon Feb 29, 2016 12:06 pm
by jason
There is no code in docx4j to create vbaProject.bin from a text file.

It would be a nice thing for docx4j and POI to have :-)

The starting point would be to read the Microsoft specs:

[MS-OFFMACRO] Office Macro-Enabled File Format
[MS-OFFMACRO2] Office Macro-Enabled File Format Version 2