[V8i] Exiting a Macro if User Cancels Reference Attach Command

We have an update to a standard notes sheet. This needs to be applied to all projects but each project has their own version of this sheet. We determined a macro that attaches the "seed" version to a project's version, fence deletes the existing note and then reference merges the "seed" version into the project version is the most efficient method to implement this update.

The macro works great inside or outside of ProjectWise. But it's not bulletproof. If the user attaches the wrong seed file or cancels before completing the process, the macro still finishes running and the results, while not devastating nor irreversible are less than ideal.

Due to the variety of possible locations where the seed file is located, it is easiest to require the user to browse to its location and manually select it. And due to its single application purpose, anything more complicated than a simple sequencing macro is not justified.

But the programmer in me wants to provide some type of escape mechanism.

The Reference Attach dialog box opens two modal dialog boxes in sequence. However the first one does not seem to activate the ImodalDialogEvent module. It's not until the user finishes browsing to and selecting the file before the code is run.

There seems to be no way to test if they cancel that first dialog box.

I found I could determine if they pick the wrong file or cancel the second dialog box, and exit gracefully.

Is there any way to halt the macro if they cancel the Reference Attach dialog box?

Parents Reply Children