Runtime error on MessageBox when selecting No

I am trying to use a MesageBox with MB_YESNO flag. When the user presses No I want it to display a message and end the procedure. The procedure is displaying the MessageBox, when selecting Yes it runs the correct programs, etc but when I select No the message is displayed then I immediately get a Runtime Error. Not sure what I need to do hopefully it’s just something easy I’m over looking. Any suggestions would be appreciated.

procedure biExtractProcess(WorkLoc: String);  
var
ProcessBatch: String;
ProcessSqliteBatch: String;
buttonSelected : Integer;
begin  
    buttonSelected := MessageBox("This Step will extract required data from SFDC, do you want to continue?","myCompany, LLC",MB_YESNOCANCEL);
    if buttonSelected = IDNO Then
        MessageBox("Step 1 has been Canceled.","myCompany, LLC",MB_ICONINFORMATION); 
    if buttonSelected = IDYES Then
        ProcessBatch := UnpackTemporaryResource("process.bat");
        ProcessSqliteBatch := UnpackTemporaryResource("biLoadExtractedObjects.cmd");     
        ChangeStatusBar("Extracting Loan data... Please Wait.",false);
        RunAProgram(ProcessBatch, WorkLoc + " extractLoanprocess", WorkLoc, true, SW_SHOWMAXIMIZED); 
        ChangeStatusBar("Extracting Relationship data... Please Wait.",false);                
        RunAProgram(ProcessBatch, WorkLoc + " extractImageLoadlookupsprocess", WorkLoc, true, SW_SHOWMINIMIZED); 
        ChangeStatusBar("Extracting Image Load Lookups data... Please Wait.",false);                               
        RunAProgram(ProcessBatch, WorkLoc + " extractClosingListprocess", WorkLoc, true, SW_SHOWMINIMIZED); 
        ChangeStatusBar("Loading Extracted Data... Please Wait.",false);
        RunAProgram(ProcessSqliteBatch, "", WorkLoc, true, SW_SHOWMINIMIZED); 
        ChangeStatusBar("Loading Data to Local DB for processing... Please Wait.",true);
        MessageBox("Step 1 has completed.","myCompany, LLC",MB_ICONWARNING); 
end;      

It’s not a problem with MessageBox but with RunAProgram. Looks like some parameter (string) is empty.

It should also be:

if buttonSelected = IDYES Then
begin

end;