Solved

Running a java app in VBA code

Posted on 2011-02-25
Medium Priority
321 Views
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
Question by:Bangerter
[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
• 2

LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 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"""

0

LVL 2

Author Closing Comment

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

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

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses
Course of the Month12 days, 20 hours left to enroll