• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to run Java Jar file without cmd prompt

Damodar

New Member
Hi,

I have a macro in Excel to run an executable jar file.

Code:
Sub Lauch_Web_Fill_()
Dim oShell
Set oShell = CreateObject("Wscript.shell")
oShell.Run "java -jar E:\ConnectToNet.jar"
End Sub

As soon as I start this macro it is working fine, but it is displaying a command prompt. I want the jar file to run without the command prompt.

Could you please give a solution for this?
 
Hi, Damodar!

Tried creating a .cmd (ex .bat) file with the "java - jar..." line and then doing this from Excel?

Code:
Option Explicit
 
Sub Lauch_Web_Fill_()
    Shell "E:\<full_path>...\cmdfile.cmd", vbHide
    ' available modifiers are:
    '  vbHide
    '  vbNormalFocus
    '  vbMinimizedFocus (default)
    '  vbMaximizedFocus
    '  vbNormalNoFocus
    '  vbMinimizedNoFocus
End Sub

If that doesn't work I'd try too with the last 2.

Hope it helps.

Regards!
 
Back
Top