Solidworks VBA - Export Pipe Spool BOM

Can anybody help??

If I have a Solidworks pipe routing containing flanges, elbows, reducers etc.

How can I export, using a Solidworks VBA macro, the pipe routing that includes the flanges, elbows etc along with every pipe length to a text file that can be opened with "notepad"?

Many thanks in advance!

Darren

SolidworksApi/macros