I have added some table management to the html editor. My problem is that when I for instance add a row to the table and press undo that he deletes the cells one by one and that is not what I want. Is there a way to add my table actions to the undo list of mshtml???

You'll need to implement IOleUndoUnit and IOleUndoManager and pack multiple undo steps into one unit which is recalled with the UNDO command internally. There are several sources on the internet about these interfaces.

The principle is that you pack any number of undo steps into one call of the undo function. I've not found any way to avoid a specific step to be not packed in a usable piece of code.

And yes, for table actions it works very fine. You must also remember that inserting 5 cells does not result in 5 steps, because you insert the row plus 5 cells (6 steps) and maybe some additional actions to handle rowspan or colspan, content of cells and much more.

Again, the way is not to avoid inserting undo steps, but packing them together. The interfaces have appropriate methods for that.