How do I stop my drawing no. macro from running on all parts and assemblies?

Hi, 

I have had to create a macro to create a separate drawing No. as we are slowly transitioning from an autocad workflow to a solidworks workflow. As an interim I have made a macro that will create a drawing No. but still let me have the part/assy and drawing with the same name for ease of opening etc and remaining linked.  

Macro in question: Drawing No. Macro - Pastebin.com 

When I run it, it creates the custom property on everything open and I only need to run it on assemblies or top level parts. 

Thoughts?

Thanks, 

Pete

SolidworksApi/macros