Solved

Running a java app in VBA code

Posted on 2011-02-25
3
309 Views
Last Modified: 2012-05-11
I have a java app that runs from a command line. I need to be able to call it in VBA.

Scenario:
I have code that populates a table and then exports that table to a CSV file. I then go manually run the java app on a command line using the new csv file as one of the runline parameters i.e. 'CalculateValues myNewInputFile.csv myNewOutputFile.csv' the app creates an output file call myNewOutputFile.csv.

I would like to automate this so that I dont have to go out and manually run the java app each time.
0
Comment
Question by:Bangerter
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34980739
Have you tried using the Shell() function:
Shell """C:\path\to\java.jar"" ""C:\path\to\file1.csv"" ""C:\path\to\output.csv"""

Open in new window

0
 
LVL 2

Author Closing Comment

by:Bangerter
ID: 34981879
Thanks. with a little tweaking i was able to get it to work. Here is the shell command I ended up with:

Shell ("D:\Data\myJavaTool.bat myInput.csv myOutput.csv")
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 34981981
That will work find if none of the paths have spaces. You would need to quote each path that has spaces (as demonstrated in my post).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now