Use WCT functions in the VBA code.
WCT allows to call comparison functions and work with results from VBA code.
To perform comparison operations you should use STWCT.ComparisonEngine object.
Members:
CompareWorkbooks( OldWorkbook, NewWorkbook, RowHasID, ColumnHasID )
OldWorkbook - object which represents old workbook
NewWorkbook - object which represents new workbook
RowHasID - (optional)first cell in row contains Field Name or Primary Key
ColumnHasID - (optional)first cell in column contains Field Name or Primary Key
CompareWorksheets( OldWorksheet, NewWorksheet, RowHasID, ColumnHasID )
OldWorksheet - object which represents old worksheet
NewWorksheet - object which represents new worksheet
RowHasID - (optional)first cell in row contains Field Name or Primary Key
ColumnHasID - (optional)first cell in column contains Field Name or Primary Key
CompareRanges( OldRange, NewRange, RowHasID, ColumnHasID )
OldRange - object which represents old range
NewRange - object which represents new range
RowHasID - (optional)first cell in row contains Field Name or Primary Key
ColumnHasID - (optional)first cell in column contains Field Name or Primary Key
Each of these functions returns instance of the Comparison Result object. Which has the following members:
MarkAllChanges()
Mark all differences, contained in this object, in Excel.
ExportToXLS()
Export all differences to new worksheet.
ExportToTXT( target file name )
target file name - (optional) name of the file which will receive list of differences Export all differences to new worksheet.
Show()
Display Comparison Report dialog.
To compare 2 worksheets, export changes to separate sheet and mark changes on the Excel sheets, you should use the following code:
' this variable will hold the comparison engine object
Dim oEngine As Object
' Create WCT Comparison Engine object
Set oEngine = CreateObject("STWCT.ComparisonEngine")
' this variable will hold comparison results
Dim oResult As Object
' do comparison
Set oResult = oEngine.CompareWorksheets( _
   Sheets("Data Sheet 0"), _
   Sheets("Data Sheet 1") _
   )
' export comparison results to new workbook
Call oResult.ExportToXLS
' mark all changes on the source worksheets
Call oResult.MarkAllChanges
' release comparison results object
Set oResult = Nothing
' release comparison engine object
Set oEngine = Nothing