Solved

Call Java program from an Excel macro

Posted on 2004-09-06
4
4,158 Views
Last Modified: 2008-08-09
I need to write a macro to be executed from an excel spreadsheet. It needs to call a java program that will perform certain functions with the data.  

Does anyone know what i need to do to achieve this ?
0
Comment
Question by:papillon2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
Discofish earned 100 total points
ID: 11991776
Try passing names/parameters to the program via the command line. I believe it the args array in Java.  You can also turn the program into an exce http://www.duckware.com/jexepack/.  Then, just capture the output. http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20193718.html 

Or if it is a JavaBean, you can try this:
http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html#supported


Otherwise, You'd need to create a DLL that uses the Java Native Interface and call it from VB.
0
 

Assisted Solution

by:darrylmg
darrylmg earned 100 total points
ID: 11994460
Instead of trying to write a complex interface, can you not try something a little "classy 'er".

What about this:

1, The excel macro copies the required data from the current workbook into a new workbook (I am assuming you are a competant macro writer).
2, The new workbook is then saved as a CSV (comma seperated variable) file to a specific name in the c:\temp directory.
3, The macro then calls the Java program and passes it the name of the CSV file in the c:\temp directory.
4, The Java program reads in the data from the CSV file and does it's stuff.

I am also assuming:
1, The Java program is configurable/editable by you.
2, The type of data required by the java program is text based.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Part One of the two-part Q&A series with MalwareTech.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question