0

I want to create a simplified function that takes couple of inputs from user.. The inputs are parameters to the java module that has a very complex logic and returns output. This output is passed to excel cell. I tried using ogga.But it is only sheet level. Any suggestions.

I have also tried running the shell commands but it just gives return.

Community
  • 1
  • 1
Anup Ash
  • 935
  • 8
  • 14
  • Try to call a WEBSERVICE from VBA-excel that communicates with a Java application. I already did it once – Solano Jan 20 '15 at 16:57

3 Answers3

1

My suggestion would be:

  1. Create a Java webservice to provide your business logic
    First Option
  2. Call this webservice from your VBA
    First Option
    Second option
Community
  • 1
  • 1
Solano
  • 550
  • 2
  • 9
  • Thanks Solano but i dont have much knowledge on setting up webservice. I will try to read some more... and get back to you .. once again thank you for your help – Anup Ash Jan 20 '15 at 18:54
  • Solano, is there a way to use jvm process instead of having tomcat servers service such a code. – Anup Ash Jan 20 '15 at 20:08
  • you need tomcat to receive the calls to your webservice. it will handle the tcp connections that you dont need to worry. tomcat is really easy just install and deploy on it using eclipse or netbeans. – Solano Jan 21 '15 at 00:33
0

just an idea: I think it is possible to have Java code converted into something that can be called from .Net. And then .Net from VBA ... Perhaps that is another option if you need to have the code locally instead of on a webservice (which might run locally too) But I think having the webservice is way better ... And easier to be maintained. Use Spring Boot for that, will be very easy ...

Marged
  • 10,577
  • 10
  • 57
  • 99
  • I did not understand the Spring Boot very well.. Is there a way i can just use the .jar file without being to actually have user run any application servers on their machines, I just want them to use this jar as a function on the excel sheet.. – Anup Ash Jan 20 '15 at 18:56
  • If you use spring boot everything will be embedded into 20 to 30 MB. Then you simply call "Java -jar yourwebservice.jar" and from then the web service sits there and waits for incoming connections. No need to install tomcat, jboss or alike ... Packtpub has a great book on spring boot, I think it still has a discount these days. For an instant start this should be a good base and there are even more examples linked from the spring.io blog – Marged Jan 20 '15 at 20:39
0

If you go for Spring Boot this is an example how to define a webservice:

@RequestMapping(value = "/complexlogic" )
@ResponseBody
public String getTopTen( @RequestParam(value = "input", defaultValue = 42) Integer input ) {
        return "The answer to anything is: " + input;
    }

This enables you to call http://localhost:8080/complexlogic?input=42 and get a result string. You need JSON ? No big deal, just define an object and modify one of the annotations.

Here is a link to the mentioned book.

Marged
  • 10,577
  • 10
  • 57
  • 99