I'm writing an Excel (XP-2007) add-in for which I need to execute code at a couple of very specific points in time whenever a user saves a workbook:
1. When the user is saving and full path to the save location is known, but before the save actually happens.
2. When the save has successfully completed.
My strategy is to handle the before save event, provide the correct save user interation myself (such as in the case of a Save As), and thereby have hooks to be able to do stuff at the right time.
The problem is that neither of the two methods I know of for displaying a Save As dialog give me the hooks above without removing Excel functionality.
GetSaveAsFilename works perfectly to give me the hooks, but the Save As dialog that is displayed is not exactly the same as the built-in dialog. For example, there is no way to add password protection from the dialog because the "General Options..." menu item doesn't appear under the Tools drop-down in the upper right corner of the Save As dialog. There are a couple of other menu items missing as well. Removing functionality is a big deal since I'm taking over all saves.
On the other hand, using the built-in dialog causes the save to happen before the dialog returns, so I miss my hook #1, but the dialog obviously has all the expected features.
The Word object model provides a way to do this by providing separate Display and Execute methods for the built-in dialog in addition to the Show method, but I don't see anything equivalent for Excel.
Anybody have any ideas?
Thanks very much,
Eric
1. When the user is saving and full path to the save location is known, but before the save actually happens.
2. When the save has successfully completed.
My strategy is to handle the before save event, provide the correct save user interation myself (such as in the case of a Save As), and thereby have hooks to be able to do stuff at the right time.
The problem is that neither of the two methods I know of for displaying a Save As dialog give me the hooks above without removing Excel functionality.
GetSaveAsFilename works perfectly to give me the hooks, but the Save As dialog that is displayed is not exactly the same as the built-in dialog. For example, there is no way to add password protection from the dialog because the "General Options..." menu item doesn't appear under the Tools drop-down in the upper right corner of the Save As dialog. There are a couple of other menu items missing as well. Removing functionality is a big deal since I'm taking over all saves.
On the other hand, using the built-in dialog causes the save to happen before the dialog returns, so I miss my hook #1, but the dialog obviously has all the expected features.
The Word object model provides a way to do this by providing separate Display and Execute methods for the built-in dialog in addition to the Show method, but I don't see anything equivalent for Excel.
Anybody have any ideas?
Thanks very much,
Eric