The QUAL2K error messages that come up most often in the qual2k-user group are four: "Run-time error 53", a ChDir (ThisWorkbook.Path) line highlighted in yellow, a run that ends with "... is aborted!" (often posted as "Simulation Aborted") and "Unexpected error". Several threads are still unanswered; one Error 53 thread, about QUAL2K 2.12b1, collects cases from 2019, 2021 and 2023 with no published fix. Most of them share one origin: the Excel workbook is not the model, but an interface that writes files to a folder, launches a Windows Fortran executable and reads what that executable leaves behind. When any link in that chain is not where the code expects it, an error appears. This guide explains the chain from the QUAL2Kw 5.1 VBA code and gives a concrete fix for each message.
Import your QUAL2Kw workbook or open the example project. Results reproduce 15 calibrated QUAL2Kw models within 5% or a small absolute band.
See the prediction engineIn QUAL2Kw 5.1, when you press the Fortran run button, the macros do this, in this order:
Workbooks(1). They check with Scripting.FileSystemObject that the folder exists; if not, they show "... is not a valid folder/path"..q2k input file.message.dat file holding the paths of the .q2k and .out files, and delete the previous .out if there is one.ChDir (Workbooks(1).Path) and look for qual2kw5.exe in that folder; if it is not there, they show "Please copy qual2kw5.exe to ...".Shell, wait for it to finish and read the .out. If that read fails, they show "... is aborted!".Chapra's QUAL2K 2.12 is not identical: its manual also requires the workbook and the Fortran executable to sit in the same folder, but the code differs in detail (the ChDir (ThisWorkbook.Path) line users report does not appear in QUAL2Kw 5.1). We have not reviewed the QUAL2K 2.12 code; what follows is based on the QUAL2Kw VBA and on Microsoft's VBA documentation, and we mark where we infer.
| Message | Most likely cause | First action |
|---|---|---|
| Run-time error 53 | A file the code looks for is not on the path (executable, .q2k, .out, message.dat) | Press Debug and see which file the highlighted line uses |
Stops at ChDir (ThisWorkbook.Path) | The workbook's path is not a normal local folder (OneDrive, network, temporary attachment) | Copy the folder to a short local path on C: |
| "... is aborted!" / Simulation Aborted | The executable failed during integration or left no readable .out | Run with the VBA button to get its own stop message and a debugger line |
| "Cannot start ..." | Windows could not launch the executable | Check that the .exe is not blocked or quarantined |
| "Unexpected error", Runtime error 11 | Wrong path, text in numeric cells, division by zero | Check B10 and the input cells you changed |
| Buttons do nothing / security risk banner | Office blocked the macros of a downloaded file | File Properties, Unblock |
According to Microsoft, Error 53 occurs when a statement such as Kill, Name or Open refers to a file that does not exist, or when the DLL named in a Declare statement cannot be found. In QUAL2K the candidates are the Fortran executable, the .q2k file, the .out file and message.dat. To find out which: in the error dialog press Debug and read the highlighted line and the path variables it uses (hover over them in the editor). The Error 53 reports in the user group come mostly from QUAL2K 2.12b1; in QUAL2Kw 5.1 a missing executable shows "Please copy qual2kw5.exe to ..." instead.
The causes we found reading the QUAL2Kw code:
Workbooks(1).Path, the first workbook open in that Excel session, and the HTS build uses ActiveWorkbook.Path. If another workbook was opened first, those paths point to its folder. A common case: if a hidden Personal Macro Workbook (PERSONAL.XLSB) loads when Excel starts, it is typically Workbooks(1), and the message then names your XLSTART folder. Check the VBA editor's Project Explorer for PERSONAL.XLSB and open QUAL2Kw as the first workbook in a fresh Excel session.In one of the group threads, someone suggested checking the Courant number for an Error 53. Numerical stability matters, but it does not by itself produce a "file not found"; start with the paths.
If the debugger highlights ChDir (ThisWorkbook.Path), the macro stopped while switching to the workbook's folder, before the model ran. That exact line is not in QUAL2Kw 5.1, which runs ChDir (Workbooks(1).Path); it comes from another QUAL2K build. Either way, the likely cause is a workbook path that is not a normal local folder:
ThisWorkbook.Path can return a web address (https://...) instead of a disk path, a behavior users report on Microsoft Q&A (a community report, not official documentation). ChDir cannot change to a URL.ChDir fails on network paths that start with \\server\...; Microsoft does not document this case, so treat it as a likely cause, not a certainty.A quick test to rule out path problems: create C:\q2k\, copy the whole folder there (workbook, Fortran executable and .q2k files), unblock the workbook if Windows marked it as downloaded (see section 6), type C:\q2k in the save-directory cell, close Excel and open that workbook first. If it runs, the location was the problem; if it does not, keep going, because at least one user in the group reports that moving to C: alone did not help. Avoid spaces, accents and very long paths: QUAL2Kw stops if the full path of the .q2k file is longer than 260 characters.
QUAL2Kw shows "... is aborted!" when the executable finished but its output could not be read. "Model Execution Error - Simulation Aborted" is how one user titled a thread about it, not the dialog text. The full QUAL2Kw message says the program "crashed during integration or there was a problem during output" and suggests checking for bad inputs, using a smaller time step, Runge-Kutta integration or adaptive time step integration. In most cases, then, it is a numerical or data problem, not a path problem. How to find it:
The message ends by asking you to send the .q2k file of the run to the model's author. Attach that file too when you post in the user group: without it, it is very hard for anyone to reproduce the problem.
QUAL2Kw shows "Cannot start" followed by the executable's path when a runtime error occurs at the Shell call or right after it, once the code has confirmed the file exists. The most likely reading is that the .exe is there but Windows refused to start it. Check whether the antivirus quarantined or blocks it, and whether the folder allows running programs (some corporate policies forbid it in user or network folders). Those two causes are our inference, not something the message states. Meanwhile, the VBA button still works.
In a thread on "Unexpected error" in QUAL2K 2.12, opened in 2017, later replies point to two causes: an incorrect save path and input cells holding words where a number is expected. Another user in the same thread reports runtime error 11 (division by zero). What to check:
Since 2022, Office for Windows blocks macros by default in files downloaded from the internet or received by email, and shows a security risk banner without an "Enable content" button. A downloaded QUAL2K workbook falls exactly into that case. The fix Microsoft documents for a single file is to open its properties in Windows Explorer and tick Unblock on the General tab, or to save it in a trusted location. Do it only for files from a source you trust, such as the official model download.
Three ways out, from smallest to largest change:
Put what you just read into practice with the full QUAL2K prediction engine
Try the prediction engine for free