Call Excel Macro from Java
Submitted by ahmadshokr on Tue, 2007-02-13 16:00.
How to call Excel Macro from JAVA enterprise
After trying more, find a satisfied solution,
since excel macro is vb code, since we can make a vb script file called from java and it calls excel macro
Example:
make a script file as content is
Dim objXL
Set objXL = CreateObject("Excel.Application")
With objXL
.Workbooks.Open ("File_Path")
.Application.Run "Macro_Name"
.Application.Quit
End With
Set objXL = Nothing
and save it as calling.vbs
in java you can call it as Runtime.getRuntime().exec("cmd /c start calling.vbs");
Enjoy it,









Thanks Ahmed :)If you are
Thanks Ahmed :)
If you are interested in Excel files manipulation with java, check this post exporting_to_excel_file which referes to http://jakarta.apache.org/poi/hssf/how-to.html and http://jxls.sourceforge.net/
Ahmed Hashim
Software Engineer
hashimblog/