简体   繁体   中英

How to edit a VB macro using Java

I have an excel where it has a macro defined in it. I am creating a Java program to perform some actions on that particular spreadsheet. Here is the small snippet of the VB code

Sub ChangeAxis()
Attribute ChangeAxis.VB_ProcData.VB_Invoke_Func = "a\n14"
 '
 'ChangeAxis Macro
 'Keyboard Shortcut: Ctrl+a
    ActiveChart.Axes(xlValue).Select
    ActiveChart.Axes(xlValue).MaximumScale = 0.8
End Sub

Now, what i will have to do is, Open that spread Sheet, edit that macro with a specific Value( ie 0.8 will be changed based on the scenarios of process), run the macro and then save the SpreadSheet.

Could someone suggest me how to edit the Macro using Java code. Or is there a way i can run this Macro VBscript from my Java code directly?

您将需要使用 Java 到 COM 库,如 JACOB: http : //danadler.com/jacob/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM