XLL, OLE Com automation and Undo stack RRS feed

  • Question

  • Hello,

    I have a XLL written in C/C++ which registers a recalc handler.

    In this recalc handler styles are set for specific ranges via OLE com Automation.

    Unfortunatly it looks like that this action clears the undo stack.

    So what I need is the possibilities to save the undo stack and then restore it.

    // save undo stack

    // set styles

    // restore undo stack

    Is this possible ?


      Hendrik Schmieder


    Monday, March 9, 2015 1:23 PM

All replies

  • Hi Hendrik,

    I'll involve some other engineer into your case, as I don't know much about XLL development. When there're some updates we'll come back.

    Thanks for your understanding.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 10, 2015 8:42 AM
  • If someone could post c# code using the Office pias I may be able to translate this then to OLE COM Automation myself.

    Wednesday, March 18, 2015 3:38 PM
  • Hi Hendrik,

    There's nothing in Excel that makes this possible. Nearly any interaction with Excel from a macro via the C API or through the COM automation interface will clear the undo stack. You can register a single macro to run as the undo from inside your macro, but that does not give you back the previous undo actions.

    One Excel-DNA user has gone as far as recording nearly every COM event, in order to provide such an undo from the add-in itself. I'm not sure that's a good idea...


    Excel-DNA - Free and easy .NET for Excel 

    Saturday, March 21, 2015 9:00 AM
  • Hello Hendrik,

    Excel does not offer any way to preserve the Undo stack, when nearly any interaction occur from a macro / OM call. This behavior is by design.


    Thursday, April 9, 2015 11:03 PM
  • Sorry for the delay, but I was in Holidays.

    I repeat what I want to do:

    a) Read the content of the undo stack and store it locally

    b) set some style (this works)

    c) Restore the undo stack from the local copy.

    b) will clear Undo stack and Pradeep Ra said this is by design and can't be avoided.

    But is a) and c) possible ?


      Hendrik Schmieder

    Thursday, April 16, 2015 9:55 AM
  • Hello Hendrik,

    Unfortunately, the Excel object model doesn't allow that.


    Monday, April 20, 2015 2:05 PM