Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:43:53+00:00 2026-06-07T03:43:53+00:00

I have learnt to read and write an Excel file using a Java program

  • 0

I have learnt to read and write an Excel file using a Java program with the help of Jxl and POI API. Is it possible to run a Java program with the help of macros?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:43:54+00:00Added an answer on June 7, 2026 at 3:43 am

    Yes, it is possible.

    There are quite a few ways actually and I hope you like my examples.

    To demonstrate this, I create a program where some text is send as arguments and program responds with an altered version of it. I made a runnable jar of it. First example reads the argument from args and other from standard input.

    File Hello.java and H1.jar:

    public class Hello {
        public static void main(String[] args) {
            StringBuilder sb = new StringBuilder("Hello");
            
            if (args.length > 0) 
                sb.append(' ').append(args[0]);
            System.out.println(sb.append('.').toString());
        }
    }
    

    File Hello2.java and H2.jar:

    import java.util.Scanner;
    
    public class Hello2 {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            StringBuilder sb = new StringBuilder("Hello");
            
            sb.append(' ').append(sc.nextLine());
            System.out.println(sb.append('.').toString());
        }
    }
    

    You can save them in a single jar, but then you need create and use a manifest (that’s a bit overkill).

    Now in Excel I add a module and a reference to Windows Script Host Object. If you do not like the sleep, then you can replace it with DoEvents:

    'add a reference to Windows Script Host Object Model
    'for example : Tools-References
    Option Explicit
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Private Sub RunSleep( _
        exec As WshExec, _
        Optional timeSegment As Long = 20 _
    )
        Do While exec.Status = WshRunning
            Sleep timeSegment
        Loop
    End Sub
    
    Private Function RunProgram( _
        program As String, _
        Optional command As String = "" _
    ) As WshExec
        Dim wsh As New WshShell
        Dim exec As WshExec
    
        Set exec = wsh.exec(program)
        Call exec.StdIn.WriteLine(command)
        Call RunSleep(exec)
        Set RunProgram = exec
    End Function
    

    And to test it I saved the files to c:\ drive and used the code:

    Public Sub Run()
        Dim program As WshExec
        Set program = RunProgram("java -jar ""C:\\H1.jar"" Margus")
        Debug.Print "STDOUT: " & program.StdOut.ReadAll
    
        Set program = RunProgram("java -jar ""C:\\H2.jar", "Margus")
        Debug.Print "STDOUT: " & program.StdOut.ReadAll
    End Sub
    

    In my case I get a responce of :

    STDOUT: Hello Margus.

    STDOUT: Hello Margus.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Java Persistence API . I have just learnt it and
Being a Java developer in an agile development cycle, I have learnt that it
I have just learnt about temporary tables and using them has given me some
I am using R to run simulations using time series data. I have been
I need to write a function that can read a file, and add all
I'm looking for information on how to read GnuCash files using python. I have
Can I read from or write to a variable defined in my assembly file
I have learnt from this post that always use <a> tags or <button> tags
I have learnt Python for about a month as a one year's PHPer.And I
I just have learnt how cool RSpec and Cabybara is, and now working around

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.