Macros of excel
can be executed using vbscript calling from a java file
using apachepoi
and jexcel api we can read and write in excel file using this jars
but to read macros we need to run vb script and this method calls
vbscript and transfer macros....or other way around use component to
change excel file in to xml file and then load it to your project
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class AccessMacro { private static void createAndShowGUI(){ JFrame frame1 = new JFrame("Run Macro"); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton button = new JButton(" >> JavaProgrammingForums.com <<"); // Add action listener to button button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Execute when button is pressed try{ Runtime.getRuntime().exec("cmd /c start runmacro.vbs"); }catch(Exception a){ System.out.println("Problem opening runmacro script!"); } } }); frame1.getContentPane().add(button); frame1.pack(); frame1.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }