How to check if the VBA module has been modified?

advertisements

I have an Excel workbook that I would like to export the code for every time the workbook is closed but I would like to do so selectively so that each module will only get exported if it has been modified since the workbook was opened. I would like to be able to use the exported files to run a diff on the code and I'm assuming that re-exporting every time will cause the files to always be flagged as different. Here's an attempt at some pseudo-code to show what I mean:

for each module in Workbook
    if module.isModified() then
        module.export
    end if
next module


VBComponent has a readonly property. Add reference to VBE and you should be able to access "changed" VBComponents

bool Saved

Saved Property - (Excel 2003 VBA Programmer's Reference Google Books)