将宏嵌入Excel 2007 xml

时间:2021-09-01 22:52:31

Anyone know if you can embed a macro in an xml file?

任何人都知道你是否可以在xml文件中嵌入一个宏?

I have an xml file that I create with a .net web application and it opens with Excel 2007, but would be nice to attach a macro to it as well. I want to attach a macro to this xml file programmatically. So that when I open this xml file in Excel 2007 than the macro runs automatically

我有一个使用.net Web应用程序创建的xml文件,它随Excel 2007打开,但也可以很好地附加宏。我想以编程方式将宏附加到此xml文件。因此,当我在Excel 2007中打开此xml文件时,宏将自动运行

Thanks.

谢谢。

1 个解决方案

#1


1  

You cannot embed a macro in an Excel 2007 XML file. It isn't supported. You also cannot embed a macro in an xlsx file, security requirements prohibit it.

您不能在Excel 2007 XML文件中嵌入宏。它不受支持。您也无法在xlsx文件中嵌入宏,安全要求禁止它。

To embed a macro you have to use a xlsm file. Howerever, even though most of xlsm is text wrapped in a zip, the macro project itself is a binary file.

要嵌入宏,您必须使用xlsm文件。但是,即使大多数xlsm是用zip包装的文本,宏项目本身也是一个二进制文件。

#1


1  

You cannot embed a macro in an Excel 2007 XML file. It isn't supported. You also cannot embed a macro in an xlsx file, security requirements prohibit it.

您不能在Excel 2007 XML文件中嵌入宏。它不受支持。您也无法在xlsx文件中嵌入宏,安全要求禁止它。

To embed a macro you have to use a xlsm file. Howerever, even though most of xlsm is text wrapped in a zip, the macro project itself is a binary file.

要嵌入宏,您必须使用xlsm文件。但是,即使大多数xlsm是用zip包装的文本,宏项目本身也是一个二进制文件。