简体   繁体   English

C#运行宏而不打开Excel

[英]C# Run macro without opening Excel

Is there a way to run a macro using Office Interop without launching the Excel application? 有没有一种方法可以在不启动Excel应用程序的情况下使用Office Interop运行宏?

If i set the Excel application to false it will still show Excel 如果我将Excel应用程序设置为false,它将仍然显示Excel

My code: 我的代码:

private void button1_Click(object sender, EventArgs e)
{
    Excel.Application oExcel = new Excel.Application();
    oExcel.Visible = false;

    oExcel.Run("'c:\\PERSONAL.XLSB'!Module1");
}

No. You need to have MS Office, particularly Excel installed in case you want to run Excel Macros. 不需要。您需要安装MS Office,尤其是要运行Excel宏的Excel。 Server Side Automation of MS Office is not recommended. 不建议使用MS Office的服务器端自动化。 Please see this link . 请看这个链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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