RAS Playground 日本語 GitHub

Getting started

Your first RAS project (VS Code)

To try RAS without installing anything, the quickest way is to open the playground in your browser. This page explains how to create a RAS project using only the VS Code UI and write a macro to an Excel workbook. For the same steps on the command line, see Your first RAS project (command line).

Download

The prebuilt ras and the VS Code extension can be downloaded from Releases.

  1. Open the latest release
  2. From Assets, download the zip for your environment and the VS Code extension ras-vscode-0.1.0.vsix, and extract the zip
File Contents
ras-v0.1.0-windows-x64.zip ras.exe, ras_com.node, ras_book.node (Windows x64)
ras-v0.1.0-windows-arm64.zip ras.exe, ras_com.node, ras_book.node (Windows arm64)
ras-v0.1.0-linux-x64.zip ras and ras_book.node (Linux x64. For debugging without Excel and offline writing)
ras-v0.1.0-macos-arm64.zip ras and ras_book.node (macOS arm64. Same as above)
ras-vscode-0.1.0.vsix VS Code extension (.vsix)

Install the extension

In the Extensions view (Ctrl+Shift+X), choose Install from VSIX… from the … menu at the top right and select the .vsix you downloaded.

The … menu of the Extensions view. "Install from VSIX…" is at the bottom

Put ras (ras.exe on Windows) somewhere on your PATH, or search for ras.path in the settings (Ctrl+,) and specify its location. The extension launches ras as a language server, and ras does everything: completion, error display, debugging, and writing to the workbook.

Create a project

Choose File → Open Folder… and open an empty folder. Create RAS Project appears in the status bar; click it. (The Create RAS Project button (the RAS logo) on the folder-name row in the Explorer and "Create RAS Project" in the Command Palette (Ctrl+Shift+P) do the same thing.)

VS Code with an empty folder open. "Create RAS Project" is in the status bar at the lower left
When you open an empty folder, **Create RAS Project** appears in the status bar.

Choose the workbook to use. To create a new one, choose Create a new empty workbook; to use an existing workbook, choose Import a workbook from elsewhere… (workbooks in the folder are also listed).

The choices for "New RAS project: Workbook". Create a new empty workbook, Import a workbook from elsewhere

Enter a name for the new workbook and press Enter (the default is the folder name).

The input box for "New RAS project: Workbook name". myproject.xlsm

When the project is created, src/main.ras containing a sample macro and the workbook's sheet preview open. The sample has already been written to the workbook.

The created project. The Explorer on the left, src/main.ras in the center, and the workbook's sheet preview on the right
File Contents
ras.toml Project settings (workbook location, etc.)
src/main.ras Standard module Main
AGENTS.md Guide for AI agents
myproject.xlsm The workbook the macros are written to

For the full structure, see Project structure. For the "Normal" font of a new empty workbook, Excel picks the one it uses for new workbooks according to this PC's display language (Yu Gothic 11 for Japanese).

Write a macro

Rewrite src/main.ras as follows. An exported function with no arguments becomes a macro you can run from Excel's Macro dialog.

// src/main.ras
/** Writes 1 to 10 and their squares in columns A and B of Sheet 1. */
export function squares() {
    for (let i = 1; i <= 10; i++) {
        Sheet1.cells(i, 1).value = i;
        Sheet1.cells(i, 2).value = i * i;
    }
    msgBox("Written");
}

When you type . as in Sheet1.cells(i, 3)., Excel members appear as suggestions. The type is shown to the right of the selected suggestion.

After typing Sheet1.cells(i, 3)., suggestions such as activate, address, and autoFill appear

Find mistakes

Type checking runs as you type, and errors get a squiggly underline. They are listed in the Problems panel (Ctrl+Shift+M); click one to jump to its location. The example below calls a function squre that does not exist anywhere.

A red squiggle under squre. The Problems panel shows "Name squre not found ras(E0201)"

Debug

Click Debug above a function to run it. If you place a breakpoint first by clicking the left edge of a line or pressing F9 on it, execution stops there.

Above squares: "Debug | Generate test". A red-dot breakpoint to the left of line 5

When execution stops at a breakpoint, the Variables view on the left shows values such as i, and the sheet preview on the right shows the sheet at that moment. Cells that changed since the last stop are highlighted with a border and listed under Changed cells. F5 (Continue) runs to the next stop, and F10 / F11 step one line at a time.

Stopped on line 5. Variable i = 3. The sheet preview shows A1 to A3 and B1 to B2 written, with the changed cells B2 and A3 highlighted

When the run finishes, the Debug Console shows the msgBox message and where the resulting workbook was saved.

After the run finished. A1:B10 of the sheet preview shows 1 to 10 and their squares. The Debug Console shows [MsgBox] Written

Where debugging runs depends on your environment (see Debugging for details).

On Windows, Run in Excel also appears above functions. It syncs to the workbook and then runs the macro in Excel.

Write to the workbook

On Windows, when the workbook is open in Excel, every time you save a .ras file the change is applied automatically to the open workbook. RAS: workbook name in the status bar shows the sync state. If the workbook is not open, you can open it and sync with Open in Excel in the status bar ("RAS: Open in Excel" in the Command Palette).

When the workbook is not open (including on Mac and Linux), the Sync with Workbook button on the folder-name row in the Explorer ("RAS: Sync with Workbook" in the Command Palette) writes directly to the workbook file without launching Excel.

After running "RAS: Sync with Workbook". A notification at the lower right: "RAS: Wrote to …/myproject.xlsm"

After writing, open the workbook in Excel and run squares from Developer → Macros. On Windows you can also choose a macro from the list with "RAS: Run Macro" in the Command Palette and run it in Excel. If a module was edited in the VBE on the Excel side, you are asked whether to overwrite it (Syncing with Excel).