Run, test and debug
Running without Excel
On Mac, Linux, Windows without Excel, CI, and in work done by AI agents, ras alone lets you go around the "write → run → verify" loop. None of it starts Excel: execution runs against the Excel stand-in (spec §14.10.8; the same as VS Code's debug run without Excel), which loads the workbook from ras.toml, and the original workbook is not modified.
ras run
ras run --list # list the functions that can be run
ras run Report.rebuildReport # run one (the module name can be omitted if it is unambiguous)
ras run ask --msgbox vbYes --inputbox "2026/4" # give dialog responses, in the order they are shown
ras run Report.rebuildReport --json # print the result as JSON
ras run Report.rebuildReport --view # also make an HTML that shows the workbook after the run as a grid
It shows the output of debug.print, the dialogs shown and their responses, and any run-time error (VBA error number, description, and the position in the .ras), followed by the changed cells. The changed workbook is saved in build/debug/workbooks/.
rows 3
Changed cells (Book.xlsx → build/debug/workbooks/Book.xlsx):
Sheet1:
D2 (empty) → 6
D3 (empty) → 10
D4 (empty) → 4
3 differences (structure 0, cells 3, names 0)
- A
msgBoxwith no response specified is answered withvbOK, and aninputBoxwith its default value (or cancelled if it has none). - Functions with parameters (
@udftoo) are called withras run Calc.add --arg 3 --arg 1.5. The return value and the values ofbyrefarguments are shown. @onhandlers run when you give what the user does with--event(ras run --event open --event "enter:Sheet1!A2=10" --event "click:Sheet1!btnRun"). In tests, usesimulate("enter:Sheet1!A2=10").- Handwritten VBA called through
application.run, and COM objects the stand-in lacks, can be replaced with functions and classes of the project (--replace-run Legacy=Mocks.legacy,--replace-object ADODB.Connection=Mocks.FakeConnection). - The exit code is 0 if the run finishes normally, 1 if it ends with a run-time error, and 2 if it could not be run (spec §14.13).
Excel stand-in
Instead of Excel, it loads the workbook file and reads and writes its cells. ras run, ras test, the playground and VS Code's debug run without Excel all use the same thing.
- Formulas are calculated by GridCraft's calculation engine, the same as xljs, and when a cell is rewritten they are recalculated as with Excel's automatic calculation.
- It supports inserting and deleting cells, cut / copy / paste, sorting and filtering, formatting (stored; not rendered), hyperlinks (
Followalso calls theFollowHyperlinkhandler), and manual calculation, and workbook and sheet events triggered by the program's own operations call the@onhandlers. Scripting.FileSystemObject,Scripting.DictionaryandVBScript.RegExpcan also be used (other COM objects cannot be created).- Operations that need Excel itself, such as calling handwritten VBA, file selection dialogs and
Application.OnTime, cause an error.
You can check before running whether the APIs you use exist in the stand-in.
ras check --target stand-in # warns about members the stand-in lacks (W0510), operations that need Excel (W0511), COM objects that cannot be created (W0512), formats not saved in the workbook (W0513) and argument values it does not support (W0514)
Writing stand-in = true under [lint] in ras.toml makes it always warn. The list of supported members is in §14.10.8 of the language specification.
The optimizations of the VBA build (bulk transfer, inlining and so on) are not applied, so timing and speed differ from the real thing. Differences from real Excel, such as the precision of long / currency / decimal and unsupported VBA standard functions, are summarized in §14.10.5.