VBA Office Sync
Install the extension, use the bottom toolbar to pick your macro-enabled Office file, edit the extracted VBA files in VS Code, save them, and test your macros back in Office.
Supports Excel, Word, PowerPoint, and Access files on Windows through Office COM automation.
What's new in v0.0.10
- Improved
VBA Sync sidebar visibility in the Activity Bar.
- Added
VBA Sync Quick Actions fallback view in Explorer.
What's new in v0.0.9
- Added
VBA Office Sync: Unload Office File and Clean Folders.
- Added a status bar button:
VBA Unload.
- Unload stops active save sync, clears the remembered Office file, and removes the extracted runtime source folder for that file.
- Added
VBA Office Sync: Start Session for one-click setup (choose file, prepare source folder, start save sync).
- Added
VBA Office Sync: Run Health Check to validate runtime prerequisites and current source state.
- Added a dedicated
VBA Sync sidebar with quick actions.
Simple workflow
- Install the extension.
- Use the toolbar at the bottom of VS Code to choose a macro-enabled Office file.
- Let the extension extract the VBA code for you.
- Edit the generated
.bas, .cls, .frm, or document module files in VS Code.
- Save your changes.
- Test the updated macros in the Office file.
The extension provides these commands:
VBA Office Sync: Choose Office File
VBA Office Sync: Start Session
VBA Office Sync: Extract VBA Files
VBA Office Sync: Import VBA Files
VBA Office Sync: Start Save Sync
VBA Office Sync: Stop Save Sync
VBA Office Sync: Sync Now
VBA Office Sync: Unload Office File and Clean Folders
VBA Office Sync: Run Health Check
Recommended start:
- Run
VBA Office Sync: Start Session.
- Edit files in the opened source folder.
- Save files to sync automatically.
Output structure
When you extract, the extension creates a temporary folder with a stable name under your system temp directory, for example %TEMP%/vba-office-sync/<WorkbookName>-<id>, with:
modules/ for .bas, .cls, .frm components.
documents/ for worksheet and ThisWorkbook module code.
.vba-sync.json manifest with extraction metadata.
Requirements
- Windows (uses Office COM automation).
- Installed desktop Office apps for the file types you use.
- In each host app Trust Center, enable Trust access to the VBA project object model.
Supported host files
- Excel:
.xlsm, .xlsb, .xlam, .xltm
- Word:
.docm, .dotm
- PowerPoint:
.pptm, .potm, .ppsm, .ppam
- Access:
.accdb, .accde, .mdb
Important behavior
- Import removes and recreates non-document modules (
.bas, .cls, .frm) from the extracted files.
- Import updates existing document modules (sheet modules and
ThisWorkbook) by replacing their code.
- The workbook is saved during import.
- Import creates timestamped backup/autosave copies in
<temp-source-folder>/backups before applying changes.
- Import aborts before deleting modules when the selected source folder is missing
.vba-sync.json or has no importable VBA files.
- Extract/import/auto-sync use an automatic source folder in the system temp directory.
- The selected workbook is remembered, so start/sync/import do not ask for the file again.
- Auto Sync On Save watches the extracted folder and imports automatically when you save VBA source files.
- Unload asks for confirmation before cleanup and then removes the extracted folder tree for the selected file.
Usage
- Run
VBA Office Sync: Extract VBA Files.
- Choose workbook.
- Edit extracted files in VS Code.
- Run
VBA Office Sync: Import VBA Files.
- Choose workbook.
Auto Sync On Save
- Run
VBA Office Sync: Start Save Sync.
- Choose workbook.
- Save
.bas, .cls, or .frm files in that folder.
- The extension automatically imports changes into the workbook.
- Use
VBA Office Sync: Sync Now any time you want an immediate import.
- Run
VBA Office Sync: Stop Save Sync when done.
Clean up after editing
- Run
VBA Office Sync: Unload Office File and Clean Folders.
- Confirm
Unload and Clean.
- The extension stops save sync (if running), forgets the selected Office file, and removes that file's extracted source folder.
Clickable UI (no Command Palette required)
- Status bar buttons:
VBA Select Workbook
VBA Choose File
VBA Files
VBA Start Session
VBA Start Sync
VBA Sync Now
VBA Stop Sync
VBA Unload
VBA Health
- Explorer title bar actions also include the same commands.
- Activity Bar now includes a
VBA Sync sidebar with a Quick Actions panel.
- If the Activity Bar container is hidden in your VS Code layout, use the Explorer fallback view:
VBA Sync Quick Actions.
Folder convention:
- Workbook:
C:\Work\Budget.xlsm
- Extracted temp folder used automatically:
%TEMP%\vba-office-sync\Budget-<id>
Notes:
- This extension is Windows-only because it depends on Office COM automation.
| |