Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: eric.smyth

Hi @eric.smyth.  I see a couple things that could be improved upon to possibly avoid some potential problems.  First of all, you should either declare your 'oRule' variable, and your 'oRuleExists' variable down within the loop, or re-set their values to False & Nothing at the start of the loop, to make sure a previous value does not carry over into the next loop.  Next, the GetRule method will not throw an error if the rule is not found, which may break the functionality of your Try...Catch block.  You need to check if oRule Is Nothing after using that method to make sure.  Also, you may need to save your changes to those referenced documents after changing the text of their internal rules, or adding an internal rule.  But you may be doing that manually, by saving the main assembly afterwards.  Maybe just an AssemblyDocument.Update2() when done.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)