I have :
Macro named "process" that does all the processing work for my worksheets.
I want my Java code that uses Apache POI, to call this macro so that it can process the sheets for me.
How can I call a Macro in Apache POI in Java ?
:: Note ::
I am using
import org.apache.poi.ss.usermodel
in Apache POI.Please, give sample code. (I am new to Apache POI and Java itself.)
You can use other tool like com4j. I created a POC just today and works like a charm. Just follow these steps:
With the code generated by tlbimp (it is just a part of com4j), create a small app and write a code like:
Further examples: com4j tutorials
I think, you can't.
Apache POI Limitations
I don't think this is possible. POI is a library to read/edit Office files, macros are a whole other beast. You would have to implement a Visual Basic for Applications Interpreter into POI to accomplish this. Macros that are already in your Excel workbook are preserved, but you cannot add new ones or call existing ones.