Solved

Running a java app in VBA code

Posted on 2011-02-25
3
308 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 74

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 74

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

746 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

12 Experts available now in Live!

Get 1:1 Help Now