Run a java program inside VBA macro function in Excel?

CarolOu

New Member
Joined
Nov 16, 2006
Messages
2
Hi,
I defined a Macro function with VBA in Excel. And inside this function, I also need to run a java program.
In "Command Prompt", I can type: "java PromA xx xx" to execute it. How could I do the same thing in Excel VBA function?
Thanks a lot!
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
'Run JAVA Program

ChDrive ("D:")
ChDir ("D:\Java\Automation Folder\bin")

Shell ("java YourProgramObjectNameHere")

'Wait for JAVA to load!

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
 

CarolOu

New Member
Joined
Nov 16, 2006
Messages
2
Joe, Thanks so much! It is exactly what I want. I spent lot of time on that... Thanks again!
 

Watch MrExcel Video

Forum statistics

Threads
1,113,928
Messages
5,545,080
Members
410,652
Latest member
Zot
Top