0

I have a Java application that is required to do a bunch of stuff to a PowerPoint file, one of which involves invoking an existing PowerPoint macro and passing parameters to it. Here are some sample code:

public static void main (String[] args) {
  createPptFile("test");
  /* Do stuff */
  /* Call macro here */
  /* Do more stuff */
}

Sub SaySomething(something)
  MsgBox(something)
End Sub

The Java application first creates a new test.pptm file, then at some point later the application is supposed to call SaySomething(something) while passing a value to it. How can I do this? What libraries, if any, would I need? Please provide some sample code to show how this can be done.

The application is to be implemented using Java 1.8, and will run on Windows 10 and using Microsoft Office 2013. Apache POI is being used to edit PowerPoint files at present, though using it is not mandatory.

thegreatjedi
  • 2,788
  • 4
  • 28
  • 49
  • http://stackoverflow.com/questions/3547587/how-to-choose-a-java-com-bridge – Tim Williams Nov 11 '16 at 03:23
  • From the question you linked, it is impressed upon me that com4j is the solution to that question. However, I have no idea what they're talking about there. I don't know what COM is, I just want to call a PowerPoint macro using Java. Can you write an answer here describing how to do that, along with sample code for clarification, please? – thegreatjedi Nov 11 '16 at 05:25
  • No I can't sorry. I'm not a Java developer, but I do know that Java-COM bridges exist, and if you want to automate Office apps from Java that is one of your options. A little Googling around those topics should get you started. However, you could also (for example) write out a small vbscript to handle the automation and just shell it out from Java. – Tim Williams Nov 11 '16 at 06:07

0 Answers0