This project has moved and is read-only. For the latest updates, please go here.

Bug with comments and button's action

Mar 12, 2012 at 10:19 AM
Edited Mar 12, 2012 at 10:32 AM


First of all I want to thank you for this great library.

We use it to generate some quite huge and complicated files without any problems apart from quite a strange one.


The excel template file that we ‘fill’ with ClosedXML has some macro and some buttons associated with them.

It seems that if there is a comment in the first sheet the button in the second sheet's button isn’t associated with a macro anymore after the generation. It is quite strange since the macro is still in the VBA code. I am not an excel expert but it seems that the mapping between a button and an action is done just with the name of that action, and the 2 names are still correct (CommandButton1 and CommandButton1_Click())


Here is the code used to generate the files:


		public void TestMacroClosedXML()
			const string xlsFile = @"test.xlsm";

			XLWorkbook cockpit = new XLWorkbook(xlsFile);

			cockpit.Worksheets.Worksheet(1).Cell(1, 2).Value = "tutu :(";




I isolated the behaviour in some tests files and attached those 4 files:

Do you have an idea where the problem can be ?


thanks for your help,

Mar 15, 2012 at 5:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.