score:9
i basically see three options for calling vba code in excel from a java application:
java com bridge: there are several tools available that allow you to call com or com automation components from java. excel is such a component. i know of jacob and jcom, but there might more such tools available.
java / vbscript / com automation: since you obviously don't need to pass data to the vba code, the simplest solution is probably to write a vbscript that starts excel, opens the document, calls the macro and closes excel. this script is started from java with
runtime.getruntime().exec("cmd /c start script.vbs");
jni: you could write a specific dll for your applications. it implements the jni interface so it can be called from java. and its implementation uses com calls to work with excel. such a dll is best written with visualstudio and it's support for c++ to call com objects.
whatever your solution will be, you basically want to execute the following commands on excel automation interface (sample in vbscript):
dim xl
set xl = createobject("excel.application")
xl.workbooks.open ("workbook.xlsx")
xl.application.run "mymacro"
xl.application.quit
set xl = nothing
you cannot compile vba code into a dll. there exists no tool for that (in contrast to the full visual basic).
i hope this answer is helpful even though i didn't understand what you mean by: "we want to assume that the user of the java application does not necessarily have immediate access to excel, but is operating on a windows machine."
Source: stackoverflow.com
Related Query
- How do I call VBA code in an Excel spreadsheet from Java?
- How to call an Excel VBA Macro from Java Code?
- How to call DblClick sub from code VBA Excel
- How to Call VBA Function from Excel Cells?
- How to check from .net code whether "Trust access to the VBA project object model" is enabled or not for an Excel application?
- How to call Outlook's Desktop Alert from VBA Code
- How do I call an Oracle stored procedure from an Excel VBA script?
- how can I create a dll from a simple python code that could be call in VBA
- How can I access selected report filter values in Excel Pivot table from VBA code or Formulas?
- How can I GZip compress a file from Excel VBA using code in an .xla file only?
- How to access VBA code from outside the Excel file?
- How to get into an Excel Spreadsheet when it's crashing upon opening it due to in-correct VBA code
- How to call VBA function from excel
- Inject and execute Excel VBA code into spreadsheet received from external source
- Need skeleton code to call Excel VBA from PythonWin
- How to trigger a click in Access database form from Excel VBA code
- How to run excel vba code from a Windows Service
- How to Call Excel VBA functions from VSTO Application addin
- Integrate Excel VBA code to Java code to finally create the feature of selecting multiple values from the drop down list in a cell of an excel sheet
- How do I properly call a value from a dynamic array? - Excel VBA
- Excel VBA code to copy paste a column from a form to a row in consolidated spreadsheet
- How to call Python script from VBA on Excel 2016 for MAC?
- How to switch to open Excel spreadsheet and work on it from Word with VBA
- How can I call System.Runtime.InteropServices.Marshal.ReleaseComObject from within an Excel 2007 VBA module
- How to call InternetGetProxyInfo from a non "Single-Threaded Apartment" thread from Excel VBA using Win32 APIs
- How to find multiple strings from Excel and copy into another spreadsheet using VBA
- How (or is it possible) to call VBA (sub or function) from ribbon added to Excel through VSTO
- Excel vba how can extract only a column from a csv into spreadsheet
- How can I make my java code compatible with all the tables in database from which I need to extract the data and then writing it back to Excel file
- How can I read a HTTP-header while making an API call from Excel VBA using JSON?
More Query from same tag
- How do I alter my VBA script so it shows all the records where a specific field is set to 'Null'?
- Applying a formula into an excel string
- Good method to parse value from PowerPivot PivotItem?
- Word Macro renaming file from excel sheet while printing as PDF
- When performing text to columns for multiple columns spaces seem to affect the delimiting process
- Adding macro from one excel sheet to another
- Calendar/date picker Year error: Wrong number of arguments
- Aggregating part of a 2d array in a column in said array
- Excel VBA Cell.Text vbNullString Issue
- Control Tab-Key behaviour in Excel with VBA
- Regex return seven digit number match only
- VBA Internet automation code not working when ie.Visible = False
- Excel Cell Properties document
- How to see from what source data comes from in ms access
- An Excel formula, find maximum and check for multiple conditions
- Copy & Paste across two work books
- VBA loop through XML nodes
- Runtime Error 3075 while excution vba query ms access
- Looping through november, december and subsequently january using VBA
- Set image transparency with VBA in Excel
- How to write in a cell based on another cell
- Comma Separator: Ignore the comma within the data using excel macro
- Aligning multiple rows to fit on one line in Excel using a macro
- Copy - Paste (iterating ) - Ms Excel - VBA
- worksheet_calculate is stuck in a loop
- VBA JSON Parsing with VBA-Web Assistance
- How to copy range from one workbook to another workbook
- Can't advance to another sheet
- VBA: Complex VLOOKUP function (two-column match vertically, one-row match horizontally). Advice on method
- Fastest Way to Compare a cell in multiple Sheets