export to csv

How to create a macro to export definition of entities, tables,attributes and columns to csv file,Any help here is greatly appreciated!