Question

I am working on a C# COM add-in specifically targeting Excel XP. I need to display my own 'Save As' dialog rather than the normal Excel dialog.

I tried handling the applicationObject.WorkbookBeforeSave and ActiveWorkbook.BeforeSave events and setting the 'ref bool Cancel' parameter to true, but Excel still pops up the 'Save As' dialog. Saving the Workbook in these event handlers doesn't make any difference.

If I handle the Click event on the Save button then the dialog doesn't pop up, but that doesn't take of when the user presses Ctrl-S to save.

Any ideas?

Thanks.

Was it helpful?

Solution

I have found a solution. It seems there is a problem with trying to cancel some events through C# in Excel XP. I found that using the code in this thread solves my problem: http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.programming/2009-10/msg04732.html

Edit: The issue causing my problem and workaround is detailed here: http://support.microsoft.com/kb/830519

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top