簡體   English   中英

如何使用Java提取VBA變量和數組?

[英]How do I extract VBA variables and arrays using Java?

剛開始使用Java,但是VBA中有很多代碼。 我試圖提取一些在VBA中創建的變量和數組,以便可以在Java中使用它們。

我正在使用Apache POI,因此可以通過直接從excel單元格中繪制來創建新變量或數組。 但是有沒有一種方法可以直接在VBA中提取變量/值集?

例如在VBA中:

DIM variable1 AS LONG
variable1 = Worksheets("Sheet1").Cells(1, 1).Value

有沒有一種方法可以將variable1提取到Java中,或者VBA / excel會“忘記”什么variable1太快而無法放入單元格中而無法使用?

您可以將POI用於類似

    FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();

    evaluator.clearAllCachedResultValues ();

    CellReference cr = new CellReference("B5"); 
    Cell cell = sh.getRow(cr.getRow()).getCell(cr.getCol());

    evaluator.evaluateFormulaCell(cell);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM