0

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

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

Thanks.

User
  • 67
  • 2
  • 13

1 Answers1

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.

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.

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182