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?
Hi Chuck,
I guess there is no way how VBA macro can check "final state" of any user tool in MicroStation. I guess at least two reasons exist:
Maybe some indirect analysis can help? When a user cancels the tool without attaching a reference, a number of references before and after should be the same.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: caddcop
Very clever! that should work! Nice "outside the box" thinking.
Charles (Chuck) Rheault CADD Manager
MDOT State Highway Administration Maryland DOT - State Highway Administration User Communities Page
Well, we needed a more bulletproof approach as the dialog interaction changes if outside of ProjectWise.
So we have a working macro, but it is showing one anomaly.
The macro is designed to update standard notes in a sheet that was created before the notes were changed. So we know where the existing notes are and can automate a process to remove the old notes, attach the new version of the file, fence clip the reference so only the new notes are visible and then merge the reference file into the master file.
For some reason, even though we use a fence to clip our reference file the clipping boundary becomes an element on the active level and remains in the file after the merge.
If I manually execute the command, no shape is created. But with the macro, it creates the shape. Does anyone know why?