RAS Playground 日本語 GitHub

Working with Excel

Syncing and importing with Excel

Write to the workbook

Command Description
ras pack Writes directly into the workbook's VBA project without launching Excel. Does not write if the workbook is open in Excel
ras sync Applies changes to the workbook open in Excel (Windows only). In VS Code it runs automatically on every save, and also with "RAS: Sync with Workbook"
ras watch Watches for changes and rebuilds (also runs pack when the workbook is closed)
ras unpack Extracts handwritten VBA in the workbook into vba/
ras build Outputs .bas / .cls / .rasmap to build/ (for importing into the VBE by hand)

Importing an existing workbook

ras sync (ras watch, and VS Code sync) and ras pack read the workbook's VBA before writing, convert handwritten code that RAS does not yet manage to RAS, and import it into the project (spec §14.7.1).

What is in the workbook Where it is imported
Standard module Module1 src/Module1.ras
Code of the sheet Sheet1 / ThisWorkbook objects/Sheet1.ras / objects/ThisWorkbook.ras (Worksheet_Change and the like become @on("Worksheet.Change") handlers, and Me and unqualified Range(...) become this.range(...). Public procedures become export functions and can still be called as Sheet1.Foo)
User form frmInput created in the VBE forms/frmInput.form.json and forms/frmInput.ras (same as ras form pull)

Writing VBA as is

Code that is hard to convert to RAS can be written as VBA in a vba block ("Writing VBA as is" in the cheat sheet).