PDA

View Full Version : Compare VBA Code in Modules



tammyl
10-06-2009, 05:22 AM
Hi,

Is there a way that i can compare VBA code in two workbooks.

I'm aware that i could export the modules to word and use it's built-in compare feature.

Just wondered if i could use code in anyway or if anybody is aware of a good add-in, as i've alot of modules and also thought i could use it for MS Access also.

Had a brief look at purchasing some software but haven't been able to clearly identify if it checks VBA code and would appreciated the forums feedback.

Cheers
Tammy

mikerickson
10-06-2009, 06:58 AM
I don't know what you want to compare about the modules. But, if the Microsoft Visual Basic for Applications Extensibility library is active, this code will return the text of a module as a vbCr delimited string.

With Workbooks("Workbook2").VBProject.VBComponents("Module1").CodeModule
MsgBox .Lines(1, .CountOfLines)
End With