Solved

Call Java program from an Excel macro

Posted on 2004-09-06
4
4,152 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 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