vba 调用 java,从VBA / VBScript / Visual Basic Classic调用Java库(JAR)

There is jar library

native C++ port is not yet available (as DLL)

I need to call from

I have 3 possibilities:

1) Wait until native port is ready

2) Use JAR library from VB via brigde (?), installed JRE required

3) Compile JAR into native DLL using GCJ and use it form VBA

I think:

pos. 1 is easy, but I must wait

pos. 3 is in practice impossible

Is there some ideas about pos. 2?

Thanks.

解决方案

It depends on whether you wish to return values from the JAR file or not. If you do not, and just wish to execute a method then you can use a "Shell" (or ShellExecute) from VB as follows:

Shell("java.exe -jar " & )

If you do need to return a value then you will more than likely need a bridge - similar discussion here (for VB.NET, but principle is the same): Can you use Java libraries in a VB.net program?

Based on that most bridges that people have created are for .NET and not for VBA/6 so you would maybe need to create your own somehow, or perhaps create a .NET DLL that is then consumed by your VBA code.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值