Macros for saving the BOM to Excel

Is it possible to create a macro that generates a BOM in an assembly, hides it, and then displays a window to save this BOM to an Excel file?