Macro for sheetmetal flat pattern

I am new to macros in SW and was trying to make one thatwould take a part that is intended to be sheetmetal and make it asheetmetal part, and add the flat pattern as a derivedconfiguration. This would be done once the part is opened an on myscreen. Attached is one I recorded for a particular part but itonly works on that part. How can I make it a general macro thatwill work on all parts?SolidworksApi macros