RAS Playground 日本語 GitHub
TypeScript-like syntaxConverts to VBA (.bas / .cls)Run and test without Excel

Another language
for Excel VBA

RAS is a scripting language you write with TypeScript-like syntax and compile to Excel VBA code.

// src/report.ras
@fast
export function rebuildReport() {
    const ws = Sheet1;
    const last = ws.lastRow();
    for (let r = 2; r <= last; r++) {
        ws.cells(r, 3).value = r * 2;      // Each loop is converted to a bulk Range ⇔ array transfer
    }
}

// Collections can be handled like arrays (expanded to For Each loops)
export function visibleSheetNames(): string[] {
    return worksheets.filter(ws => ws.visible == xlSheetVisible).map(ws => ws.name);
}

Playground

Try transpiling RAS to VBA, running, and testing it in the browser, and download the result as .xlsm.

Your first RAS project (VS Code)

Install the VS Code extension and follow the steps from creating a project to writing it to a workbook.

Your first RAS project (command line)

The steps from creating a project to writing it to a workbook with ras init, ras check, ras run, and ras pack.

Cheat sheet

Differences from TypeScript, types, syntax, Excel operations, tests, commands, and more.

Develop without Excel

With ras run, ras test, and ras book, write, run, and verify even on Mac, Linux, and CI.

RAS standard library

Range extension methods, file I/O, CSV, JSON, XML, dialogs, and input validation.

Excel and VBA type definitions

A list of the Excel, VBA, Office, MSForms, and Scripting members used for completion and type checking.

What you can do with RAS

Excel VBA development, made comfortable from end to end

Write code, verify it, apply it to the workbook, fix it. The development flow that was manual work in the VBE becomes one continuous process in VS Code and the command line.

Type checking

Types such as int / string and Excel object types reveal mistakes before you run. It also warns about VBA pitfalls such as implicit type conversion and reliance on the active sheet.

Completion

Completion of Excel and VBA members, hovers with types and descriptions, argument information, go to definition, rename, and automatic import of names you have not imported yet.

Compilation

Converts to readable VBA (.bas / .cls). Loops that read and write cells one by one become bulk Range and array transfers, and map / filter become loops. ras pack writes to a workbook without launching Excel, and ras sync applies changes to an open workbook.

Testing

Write tests in the same form as vitest in test/*.test.ras and run them with ras test. The workbook is restored to its original state for every test, and dialogs such as msgBox are replaced.

Debugging

In VS Code, set breakpoints in .ras files, step through the code, and inspect variables and watch expressions. On Windows it runs against the real Excel; elsewhere it runs against the Excel stand-in.

From existing VBA

Handwritten VBA and user forms in a workbook can be converted to RAS and imported. Lines that could not be converted are kept as comments and reported as warnings.

Your first RAS project (VS Code) ・ Your first RAS project (command line) ・ Testing ・ Debugging ・ Syncing and importing with Excel

Building and using forms, made simpler

Design by drag and drop. Show one from code. With RAS you can create forms freely to suit the purpose. Event handling and input validation are written in code you are used to.

Build in the designer

The user form designer. Place controls from the toolbox on the left and edit properties in the panel on the right
// forms/frmEntry.ras — form code
import * as z from "validation";

const form = new z.FormValidator();

function constructor() {
    form.rule(this.txtName,
        z.string().required("Enter a name").max(20));
}

@on("btnOK.Click")
function ok() {
    if (!form.validateAll()) return;  // Show errors under the fields
    this.close(this.txtName.text);
}

Show a form from code alone

// src/settings.ras — a dialog built without a designer
import { Dialog, choose } from "dialog";
import * as z from "validation";

export function askExport() {
    const d = new Dialog("Export");
    const kind = d.select("Format", ["CSV", "TSV"]);
    const file = d.file("Output", dialogType: 2)
        .required("Choose an output location");
    const memo = d.text("Memo").rule(z.string().max(200));
    if (d.show() != 0) return;        // 0 is OK
    debug.print(kind.text, file.text, memo.text);
}

export function confirmClear(): boolean {
    const buttons = ["Clear", "Cancel"];
    return choose("Clear the input?", buttons, cancel: 1) == 0;
}

User forms ・ Dialogs ・ Input validation ・ Form controls

Develop without Excel

The Excel stand-in loads workbooks, so you can run the write, run, verify cycle on Mac, Linux, and CI too. The original workbook is never modified.

Run

ras run runs a function and shows the output of debug.print, the .ras location of run-time errors, and the cells that changed. You can also specify responses to dialogs.

Test

ras test does not launch Excel, so it works on CI as is. Formulas are recalculated every time a cell is rewritten.

Edit workbooks

With ras book, look inside a workbook (dump / view), compare before and after a run (diff), and edit cells, rows, and formatting (edit). You can also edit in the sheet preview in VS Code.

$ ras run Report.rebuildReport
Changed cells (Book.xlsx → build/debug/workbooks/Book.xlsx):
Sheet1:
  D2	(empty) → 6
  D3	(empty) → 10
2 differences (structure 0, cells 2, names 0)

The stand-in supports only some Excel features. Operations that need Excel itself, such as calling handwritten VBA or Application.OnTime, do not work. ras check --target stand-in tells you before you run whether the APIs you use are supported.

Run without Excel ・ Inspect and compare workbooks ・ Edit workbooks ・ Playground

Develop together with AI agents

A typed language, a language specification document, and a CLI that lets you verify results without Excel. AI agents (such as Claude Code) can write and verify on their own without relying on guesses.

Guide and specification

ras init places AGENTS.md, a guide for agents. Look up syntax with ras cheatsheet, and every rule in the language specification and llms.txt.

Type definitions

The members of Excel, VBA, Office, and MSForms are type definitions, so ras check points out nonexistent methods and wrong arguments right away. Plausible mistakes never reach the workbook.

CLI

Diagnostics come as one JSON object per line with --message-format json. ras explain explains how to fix an error, and ras check --fix fixes the warnings that can be fixed mechanically.

An agent can learn about the workbook without guessing, check what it wrote, and verify the cells that result from running it.

ras book dump --sheet Sheet1 --range A1:F20   # 1. Learn about the workbook
ras check --message-format json               # 2. Check
ras run Report.rebuildReport                  # 3. Run
ras test                                      # 4. Verify

Using RAS with AI agents ・ Cheat sheet ・ Language specification

It targets Excel for Windows (Office 2007 and later, 32-bit / 64-bit).