С кодом, сгенерированным tlbimp (это просто часть com4j), создайте небольшое приложение и напишите код, подобный:
// Starts excel and open an existing workbook
_Application app = ClassFactory.createApplication();
app.setVisible(0, true);
_Workbook wb = app.getWorkbooks().open("c:\\test.xlsx", null, null, null, null, null, null, null,
null, null, null, null, null, null, null, 0);
// run a macro
Variant macro = new Variant(Variant.Type.VT_BSTR);
macro.set("my_macro");
wb.getApplication().run(macro, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null);
// Save the excel file and quit
Variant saveBeforeExit = new Variant(Variant.Type.VT_BOOL);
saveBeforeExit.set(1);
wb.close(saveBeforeExit, Variant.getMissing(), Variant.getMissing(), 0);
app.quit();