macro hanging with large assembly

I have a macro that works well on small to medium sized assemblies but does not do well with large assemblies.

The macro looks at a drawing BOM and updates a custom properties field with the QTY from the drawing.  Is there a better way to accomplish this or clean up my macro,  I am not a programming expert.  Thanks.   

SolidworksApi macros