Exit Codes When Calling DiffEngineX Programmatically
DiffEngineX returns meaningful exit codes when called programmatically or from batch files. Only versions 2.22 and above return codes -5, -6 and -7. Only versions 3.02 and above return codes -8, -9, -101 and -102.
Exit Code | Description |
---|---|
Positive Integer | Number of worksheet cell differences |
0 | No worksheet cell differences found |
-1 | General Error |
-2 | Number of differences greater than maximum integer value |
-3 | Workbooks could not be compared due to protected worksheets |
-4 | Workbooks are different, at least, because of unpaired worksheet names |
-5 | Row or column alignment has failed |
-6 | Visual Basic difference report could not be displayed in a web browser |
-7 | Visual Basic difference report could not be output |
-8 | Error while comparing Excel defined names |
-9 | Error while comparing comments |
-101 | No worksheet cell differences found, but differences found in one or all of VBA, names or comments* |
-102 | Worksheet cells differences found and differences found in one or all of VBA, names and comments* |
* The switches /comparevisualbasic, /compareexcelnames and /comparecomments must be specified if you wish to check for differences in VBA macros, defined names and comments.
In summary any positive integer, -4, -101 and -102 signify differences have been found in the Excel workbooks. 0 means no differences have been found. All the other codes signify errors or that checking for differences could not be completed.
A sample batch file (*.bat) testing the exit code is given below.
@echo off
del r.xlsx
"C:\Program Files\Florencesoft\DiffEngineX\DiffEngineX" /inbook1:"a.xlsx" /inbook2:"b.xlsx" /report:r.xlsx
@if "%ERRORLEVEL%" == "0" goto good
:fail
echo Workbooks are different or error occurred
echo return value = %ERRORLEVEL%
goto end
:good
echo Workbooks have no cell differences
echo return value = %ERRORLEVEL%
goto end
:end