I have learnt to read and write an Excel file using a Java program with the help of Jxl and POI API. Is it possible to run a Java program with the help of macros?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it is possible.
There are quite a few ways actually and I hope you like my examples.
To demonstrate this, I create a program where some text is send as arguments and program responds with an altered version of it. I made a runnable jar of it. First example reads the argument from args and other from standard input.
File Hello.java and H1.jar:
File Hello2.java and H2.jar:
You can save them in a single jar, but then you need create and use a manifest (that’s a bit overkill).
Now in Excel I add a module and a reference to Windows Script Host Object. If you do not like the
sleep, then you can replace it withDoEvents:And to test it I saved the files to
c:\drive and used the code:In my case I get a responce of :