title: How to obtain the name of an active Excel spreadsheet and pass it into Java?
body: <p>I am working on a Java app that I need to integrate with Excel.  </p>
  
  <p>When testing the Java app, I can hard code the excel workbook name and can do everything that I need to.  </p>
  
  <p>But, the intention is to have an excel workbook open and run a vb macro that launches the Java code and populates the FileInputStream name with the active workbook name, not hard code the workbook name in.   </p>
  
  <p>What I need to do is either:  </p>
  
  <p>In Java, somehow get the name and path of the current active excel workbook as a text string and use that in my code in place of the hard coded name, as the intention is to have it run on various workbooks. </p>
  
  <p>I was unable to find a way of doing that via Apache POI. </p>
  
  <p>There only seems to be a getSheetName method available?   </p>
  
  <p>Or alternatively, I can probably get vb to get the name of the current workbook as a string, but I'm unsure how I would pass that string into Java to use as the workbook name string variable.  </p>
  
  <p>That's the only sticking point, everything else in the java code runs as I would like it to.  </p>
  
  <p>Any advice would be greatly appreciated.</p>