none
Canceling Save event in VSTO solution blocks the save in other spreadsheets. RRS feed

  • Question

  • I think I have found an Excel bug. In my VSTO customization I set the cancel property to true in the save event. This appears to be effecting other spreadsheets. You need to follow the exact repro steps.

    1. Open a new Excel workbook.

    2. Edit the workbook.

    3. Open a VSTO project where you have set Cancel = true in the workbook save event.

    4. Go back to the first workbook and try to save.

    Result: The browse button is a no-op. If you attempt to close you get prompted to save, but the save button is a no-op.

    Oddly if you open the first workbook but do not edit it until after you have opened the VSTO workbook, the save feature works as expected.

    Tuesday, April 23, 2013 6:32 PM

Answers

  • Hi Jeff,

    Workbook Name, Custom Document Property, or a Hidden Worksheet are three potential ways.


    Kind Regards, Rich ... http://greatcirclelearning.com

    • Marked as answer by jeffki Wednesday, April 24, 2013 9:33 PM
    Wednesday, April 24, 2013 9:25 PM

All replies

  • The BeforeSave Event is raised when any active workbook in the system is saved. Thus you need to verify that it's the workbook save you want to stop.

    Kind Regards, Rich ... http://greatcirclelearning.com

    Tuesday, April 23, 2013 9:35 PM
  • How do I detect that the workbook object sent in the event matches the workbook that I am concerned with?
    Wednesday, April 24, 2013 9:14 PM
  • Hi Jeff,

    Workbook Name, Custom Document Property, or a Hidden Worksheet are three potential ways.


    Kind Regards, Rich ... http://greatcirclelearning.com

    • Marked as answer by jeffki Wednesday, April 24, 2013 9:33 PM
    Wednesday, April 24, 2013 9:25 PM