Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Call Java program from an Excel macro

Posted on 2004-09-06
4
Medium Priority
?
4,161 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 400 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 400 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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 …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
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 …
Six Sigma Control Plans

715 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