Can you keep an assembly from rebuilding when opening it in API

I have an API where an assembly is opened, and then then some mates in the assembly are changes based on the user input.  The problem is that every time the assembly is opened, the assembly rebuilds which takes about 22 more seconds and then it changes the mates.  I've tried using the EnableAssemblyRebuild command, but it is still rebuilds, and I also tried using the method from this thread https://forum.solidworks.com/thread/21333

Here is the beginning of my code to open up an assembly.


Set Part = swApp.ActiveDoc
Set Part = swApp.OpenDoc6("Z:\chassis\part22.SLDPRT, 2, 0, "", longstatus, longwarnings)
boolstatus = swApp.SetUserPreferenceIntegerValue(swRebuildOnActivation, swDontRebuildActiveDoc)

With that code, everytime part22 is opened, it automatically starts rebuilding, and I don't want it to.

Thanks

SolidworksApi macros