如何使用Javascript代码运行Excel宏? [英] How to run excel macros using Javascript code?

查看:804
本文介绍了如何使用Javascript代码运行Excel宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以使用JavaScript代码访问Excel工作表,但我想在该Excel工作表中调用或运行Macro ...

谁能帮我修复它.

提前致谢.
等待答复.

Hey

I can access Excel sheet using JavaScript code but I want to call or run Macro in that excel sheet...

Can anyone help me to fix it.

Thanks in advance.
Waiting for reply.

推荐答案

这是Excel宏问题,而不是Java问题.

在要打开的工作表中,转到VBE.
打开``ThisWorkbook''

在这里,您可以从模块窗格左上方的对象"下拉列表中选择工作簿".

键入Private Sub Workbook_Open()并放入宏调用.

示例:
This is an Excel Macro question, not a java question.

In the sheet you want opened, go to the VBE.
Open ''ThisWorkbook''

Once here, you can select "Workbook" from the Object drop down list, located in the top left of the module pane.

Type Private Sub Workbook_Open() and put in the macro call.

Example:
Private Sub Workbook_Open()
Run "Macro1"
End Sub




然后,无论何时打开工作簿,宏都会运行,无论您是自己从Excel,另一个Excel工作表还是通过Java等调用它.


希望对您有帮助,请投票表决!




Then whenever the workbook is opened, the macro will run, regardless of whether it is called by yourself from Excel, by another Excel sheet, or by java etc.


I hope this helps, please vote up if it does!


this[^] might help you.


这篇关于如何使用Javascript代码运行Excel宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆