Results 1 to 9 of 9
  1. #1
    musicgold is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default Excel macros to control Java application

    Hi,

    Is there a way to create a macro to control a Java-based application interface? I have a Java based application on which I spend a lot of time doing repetitive tasks.
    I use Excel based macros to access web pages and download files. I wonder if there is a similar way to have a macro in Excel which can open the Java application and feed the necessary information in its text boxes.

    Thanks,

    MG.

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    Not sure about excel but you could write a java application to do that. load.exec("command.exe", some text file with the information)

    This would require you to write a batch file that changes to the directory the java application is saved and then run it from there. As far as feeding the information to it I'm not sure

  3. #3
    musicgold is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default

    xcallmejudasx,

    Thanks. Could you point me to a site where I can read the basics of creating the java application you mentioned?

    MG.

  4. #4
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    Do you know Java programming? If not then I wouldn't recommend this option because it may require some complex working.Java 2 Platform SE 5.0 is the class you use to open run a program from within Java. I know you can tell it what file to open using what program but I have no idea if you can also give it extra information and say populate some fields with information on load.

  5. #5
    musicgold is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default

    xcallmejudasx,

    Thanks. No, I don't know Java programming.

    MG.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You might want to try out a windows batch language such as WinBatch. They can help you automate repetitive tasks and since they're built to do this, they're a lot easier to use than Java or to try to shoehorn another language's macros to do something they weren't intended to do.

  7. #7
    cpf
    cpf is offline Member
    Join Date
    Apr 2009
    Posts
    3
    Rep Power
    0

    Default

    You can use Obba (Java Object Handler) to call Java methods (as well as working with Java objects) directly from Excel cells. Alternative it can be done with XLL4J, however this requires some additional coding in Java.

  8. #8
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Most have missed the point of the OP. They want to control Java from Excel, not the other way around.

    In short, it shouldn't be done. Excel macros are designed for writing macros for Excel, not for general batch tasks.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  9. #9
    cpf
    cpf is offline Member
    Join Date
    Apr 2009
    Posts
    3
    Rep Power
    0

    Default

    If I understand the original post correctly, then he has a some sophisticated functionality written in Java and he would like to access this functionality from excel.

    While I would agree that you should use a macro (i.e., a vba sub) to control java, the solution to his problem could be to provide the required functionality as a user defined function. This function could be implemented in vba (as a vba function) or in C or C++ (as an XLL) or in Java. The additional functionality then is an add in (or plug in).

    In the industry (e.g. finance) Excel is usually extended with add ins written in C or C++ or C# (xlls or dlls). The solution(s) I mentioned allow to extend excels FUNCTIONality via Java libraries.

Similar Threads

  1. Replies: 1
    Last Post: 12-30-2010, 02:48 PM
  2. Apache POI and VB macros
    By Webuser in forum New To Java
    Replies: 0
    Last Post: 12-02-2008, 07:10 AM
  3. Replies: 0
    Last Post: 07-31-2008, 11:44 AM
  4. POI - excel macros manipulation
    By Jay in forum Advanced Java
    Replies: 0
    Last Post: 07-31-2008, 11:04 AM
  5. control app width based on certain control
    By thebillybobjr in forum SWT / JFace
    Replies: 0
    Last Post: 05-15-2008, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •