I've managed to create a very basic macro enabled spreadsheet via OpenXML (merging a VBA macro from another spreadsheet along the way).
The generated spreadsheet opens up correctly in Excel - the macro is present, together with the data I've put in there.
However, when I try to use ClosedXML to open the file, I get a "NullReferenceException was unhandled" error message appear.
Here's the code for opening the file:
var nwb = new XLWorkbook("C:\\Temp\\ExcelTest.xlsm");
I've attached the file.
Any help would be appreciated...
Comments: So I thought macrosheets where not being loaded, hence my comment before. I was wrong, it just turns out Worksheet.Position is 1 based, not 0 based. We may want to add more info to that exception, but I guess that is besides the point of this issue. Pull request submitted https://closedxml.codeplex.com/SourceControl/network/forks/NickNack2020/ClosedXml?branch=macro
The generated spreadsheet opens up correctly in Excel - the macro is present, together with the data I've put in there.
However, when I try to use ClosedXML to open the file, I get a "NullReferenceException was unhandled" error message appear.
Here's the code for opening the file:
var nwb = new XLWorkbook("C:\\Temp\\ExcelTest.xlsm");
I've attached the file.
Any help would be appreciated...
Comments: So I thought macrosheets where not being loaded, hence my comment before. I was wrong, it just turns out Worksheet.Position is 1 based, not 0 based. We may want to add more info to that exception, but I guess that is besides the point of this issue. Pull request submitted https://closedxml.codeplex.com/SourceControl/network/forks/NickNack2020/ClosedXml?branch=macro