Hi @marcel.coufreur. I am not sure which of the codes above you may be trying to use, but I was referring to an iLogic rule, not a VBA macro. If the code you are using starts with "Sub Main", and ends with "End Sub" (both unquoted), then you would need to put the code to update the document on a line just above the "End Sub". But if your code does not have those terms enclosing the code, you could just put the line of code for updating the document at the very end, on its own line. The "InventorVb.DocumentUpdate" line will only work within an iLogic rule, and will not be recognized in a VBA macro. But both iLogic and VBA would both recognize a line like the following.
ThisApplication.ActiveDocument.Update
But to explain a bit more about the 'regenerate rules' thing, I am not sure there is an official online help page for this, but it is basically used to reconnect parameter recognition within internal iLogic rules. What that means is, when the iLogic rule is an internal one (saved within an Inventor document), and you include the unquoted names of parameters (that exist within that same document) within that rule, that will cause the rule to be triggered to run any time the value of any of those parameters changes. Sometimes either that triggering action, or the rule's ability to recognize that unquoted parameter name as representing a parameter gets broken some reason, clicking that tool will fix that association, recognition, and triggering behavior.
Below is a link to some online help documentation that mentions this.
To Work with Rules in iLogic (and scroll to the heading "Run Rules", where this is mentioned)
You can also see a description of it when you hover your mouse over the Regenerate All Rules button for a while.
When you use that tool, not only will it try to fix any problems, but it will run all of the internal iLogic rules within that document, and within any referenced documents too. So be very careful using that tool while a large assembly may be open on your screen, and it may contain many other components that contain some internal iLogic rules.
Wesley Crihfield

(Not an Autodesk Employee)