I have a VB macro created. I want to pass the macro a string and a file location. How would I call this in java code. Is there a library for this?
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.
You can run vbscript using the “cscript.exe” that ships with windows.
Depending upon your scenario, you can launch this from Java in a variety of ways:
EDIT: If your script has a GUI, then use “wscript.exe”.
I’m assuming you mean vbscript, but if you reall mean a macro, such as a Word macro, then you will need to do something like this:
Alternatively, you can create a small vbscript that instantiates the Word Application and uses the run() method to invoke a macro. You execute that script using cscript.exe/wscript.exe.