Cat5Dev is a VSCode extension that syncs VBA modules between VSCode and CATIA V5.
Sync VBA modules between CATIA V5 and your local workspace.
- Pull — Export all VBA modules from the target CATIA project to the local
modules/folder - Push — Import local VBA modules back into CATIA (only changed files are transferred, unchanged modules are skipped for speed)
Select the CATIA VBA project to sync with via a quick-pick dialog.
The selected project name is saved in catia-vba.json and persists across sessions.
A dedicated panel in the Activity Bar shows the current state of your workspace.
- Displays the target project name
- Modules are grouped by type:
- Standard Modules (
.bas_utf) - Class Modules (
.cls_utf) - UserForms (
.frm_utf)
- Standard Modules (
- Click any module to open it in the editor
- The tree updates automatically when the target project is changed
- Right-click any module to access context menu options:
- Rename — Rename the module file
- Delete — Delete the module file (with confirmation)
- Copy Path — Copy the full file path to clipboard
Quick-access buttons are available in the panel title bar:
| Icon | Action |
|---|---|
| ☁️↓ | Pull from CATIA |
| ☁️↑ | Push to CATIA |
| ⚙️ | Select target project |
| 🔄 | Refresh module list |
| 🌐 | Switch language |
The extension supports both Japanese (日本語) and English.
- Click the 🌐 button in the panel title bar to switch languages
- The language preference is saved in
.vscode/settings.json - All UI messages, TreeView labels, and tooltips will be translated
- A reload of VSCode is required to apply the new language setting
VBA symbols are recognized and exposed to VSCode's navigation features:
- Breadcrumb — Shows the current
Sub/Function/Propertyname as you move the cursor - Outline view — Lists all procedures and properties in the current file
- Go to Symbol (
Ctrl+Shift+O) — Jump directly to any procedure
Recognized symbol types: Sub, Function, Property Get/Let/Set, Type, Enum
A built-in VBA linter runs in real time as you edit .bas_utf, .cls_utf, and .frm_utf files.
Diagnostics are displayed inline as squiggly underlines and shown in the Problems panel.
Rules:
| Code | Rule | Severity |
|---|---|---|
| VBA001 | Option Explicit not declared |
Warning |
| VBA002 | On Error Resume Next usage |
Warning |
| VBA003 | GoTo usage (excluding On Error GoTo) |
Warning |
| VBA004 | Line exceeds maximum length (default: 200) | Warning |
| VBA005 | Variable declared with Dim but never used |
Warning |
| VBA006 | Nesting depth exceeds threshold (default: 5) | Warning |
| VBA007 | Sub/Function exceeds line count threshold (default: 100) | Warning |
| VBA008 | Mismatched parentheses | Error |
| VBA009 | Missing End If / End Sub / End Function etc. |
Error |
Configuration (cat5dev.toml):
Linting is disabled by default. To enable it, create a cat5dev.toml file in your workspace root:
- Run
cat5dev.initfrom the Command Palette to generate a configuration template, or - Manually create
cat5dev.tomlwith the following structure:
[lint]
enabled = true
[lint.rules]
option_explicit = true
on_error_resume_next = true
goto = true
max_line_length = 200 # 0 = disabled
unused_variables = true
max_nesting_depth = 5 # 0 = disabled
max_function_lines = 100 # 0 = disabled
unmatched_parens = true
unmatched_blocks = trueChanges to cat5dev.toml take effect immediately on save — no reload required.
A built-in VBA code formatter runs automatically on save (or via Shift+Alt+F).
Default formatting:
- Keyword capitalization (
dim→Dim,end if→End If, etc.) - Indentation correction (blocks:
Sub,If,For,With,Select Case, etc.) - Trailing whitespace removal
- Space before continuation marker (
Show(_→Show( _) - Continuation line indentation (
_lines get +1 extra indent; closing-only lines like)are exempt) - Blank line normalization (max 2 consecutive blank lines; blank line guaranteed between procedures)
Optional formatting (disabled by default):
| Option flag | Description |
|---|---|
-normalize-operator-spacing |
x=1+2 → x = 1 + 2 |
-normalize-comma-spacing |
foo(a,b) → foo(a, b) |
-normalize-comment-space |
'comment → ' comment |
-normalize-then-placement |
If x _\n Then → If x Then |
-split-colon-statements |
Dim x: x = 1 → two lines |
-expand-type-suffixes |
Dim x% → Dim x As Integer |
-normalize-on-error |
On Error style normalization |
- CATIA V5 must be running with a VBA project open
- Windows (uses COM automation via
cscript.exe)
Cat5Dev is distributed as a .vsix file. Install it as follows:
-
Download the
.vsixfile
Obtaincat5dev-x.x.x.vsix(or later) from the release page. -
Install in VSCode
In VSCode, open the Extensions view (Ctrl+Shift+X), then click the⋯menu in the top-right corner and select Install from VSIX... -
Select the file
Choose the downloaded.vsixfile and confirm installation.
Before using Cat5Dev for the first time, backup your CATIA V5 settings folder:
- Folder path:
%APPDATA%\Dassault Systemes\CATSettings - Why: In rare cases, CATIA settings can become corrupted or misconfigured. Having a backup allows you to restore settings if needed.
Backup procedure:
1. Press Win+R and type: %APPDATA%
2. Navigate to Dassault Systemes\CATSettings
3. Right-click and select "Copy"
4. Paste it in a safe location (e.g., Desktop, OneDrive, etc.)
5. Rename the backup folder (e.g., "CATSettings_backup_2026-04-18")
<workspace>/
├── .vscode/
│ └── settings.json # Target project & language settings
├── cat5dev.toml # Lint configuration (generated by cat5dev.init)
└── modules/
├── MyModule.bas_utf # Standard Module
├── MyClass.cls_utf # Class Module
└── MyForm.frm_utf # UserForm
Settings are stored in
.vscode/settings.jsonwith keys:
targetProject— The name of the target CATIA VBA projectlanguage—"ja"for Japanese,"en"for English (default:"ja")
- Install the extension
- Open a workspace folder in VSCode
- Click the Cat5Dev icon in the Activity Bar
- Click ⚙️ to select the target CATIA VBA project
- Click ☁️↓ Pull to import modules from CATIA into the
modules/folder - Edit your VBA code in VSCode
- Click ☁️↑ Push to sync changes back to CATIA
After pushing from VSCode, you must save the project in CATIA's VBA Editor (Tools > Save, or Ctrl+S inside the VBA Editor).
Push writes the module code into CATIA's in-memory VBE. If CATIA is closed without saving, all pushed changes will be lost.
VSCode (edit) → Push → Save in CATIA's VBA Editor ✅
↓
Changes are persisted in the CATIA document
- VBA files are stored in UTF-8 encoding with a
_utfsuffix to distinguish them from CATIA's native Shift-JIS exports - The extension targets CATIA V5's VBE (Visual Basic Editor) via COM (
MSAPC.Apc) - Debug execution within VSCode is not currently supported; use CATIA's own VBA IDE for debugging
I’ve experimented with CATIA V5 macro development in several languages, but there are a few reasons why I ultimately returned to VBA:
- Native support — VBA is built directly into CATIA V5
- Best development environment — The VBE is still the most complete and stable option
- Surprisingly fast — In many cases, VBA outperformed alternatives
- Compact distribution — No external runtimes or dependencies required
Do I like VBA as a language?
Well… that’s a different question entirely.
I have only ever used the Japanese version of CATIA V5, so I am familiar only with files exported from the VBA Editor being saved in Shift‑JIS. Because this was quite inconvenient, Cat5Dev automatically converts the encoding to UTF‑8 during the Pull/Push process.
If you encounter garbled characters when using this extension in your environment, you may need to adjust the encoding settings. Unfortunately, I have no way to verify its behavior outside of a Japanese environment.
If you run into any issues, please feel free to let me know.
MIT
Cat5Dev は、VSCode と CATIA V5 の間で VBA モジュールを同期する VSCode 拡張機能です。
CATIA V5 とローカルワークスペース間で VBA モジュールを同期します。
- Pull — 対象 CATIA プロジェクトからすべての VBA モジュールをローカルの
modules/フォルダにエクスポート - Push — ローカルの VBA モジュールを CATIA にインポート(変更されたファイルのみ転送し、未変更のモジュールはスキップして高速化)
クイックピックダイアログから同期する CATIA VBA プロジェクトを選択できます。
選択したプロジェクト名は catia-vba.json に保存され、セッションをまたいで維持されます。
アクティビティバーに専用パネルを表示し、ワークスペースの現在の状態を確認できます。
- 対象プロジェクト名を表示
- モジュールはタイプ別にグループ化:
- 標準モジュール (
.bas_utf) - クラスモジュール (
.cls_utf) - ユーザーフォーム (
.frm_utf)
- 標準モジュール (
- モジュールをクリックするとエディタで開く
- 対象プロジェクトを変更するとツリーが自動更新
- モジュール上で右クリックするとコンテキストメニューが表示:
- 名前変更 — モジュールファイルの名前を変更
- 削除 — モジュールファイルを削除(確認あり)
- パスをコピー — ファイルの完全パスをクリップボードにコピー
パネルタイトルバーにクイックアクセスボタンが表示されます:
| アイコン | 操作 |
|---|---|
| ☁️↓ | CATIA から Pull |
| ☁️↑ | CATIA へ Push |
| ⚙️ | 対象プロジェクトを選択 |
| 🔄 | モジュール一覧を更新 |
| 🌐 | 言語を切り替え |
拡張機能は**日本語(日本語)と英語(English)**に対応しています。
- パネルタイトルバーの 🌐 ボタンをクリックして言語を切り替え
- 言語設定は
.vscode/settings.jsonに保存されます - すべての UI メッセージ、TreeView ラベル、ツールチップが翻訳されます
- 新しい言語設定を適用するには VSCode の再読み込みが必要です
VBA シンボルが認識され、VSCode のナビゲーション機能に公開されます:
- ブレッドクラム — カーソル位置の
Sub/Function/Property名を表示 - アウトラインビュー — 現在のファイルのすべてのプロシージャとプロパティを一覧表示
- シンボルへ移動 (
Ctrl+Shift+O) — 任意のプロシージャに直接ジャンプ
認識されるシンボルタイプ: Sub、Function、Property Get/Let/Set、Type、Enum
.bas_utf・.cls_utf・.frm_utf ファイルの編集中、リアルタイムで VBA Lint が実行されます。
診断結果はエディタ上の波線と Problems パネルに表示されます。
ルール一覧:
| コード | ルール | 重要度 |
|---|---|---|
| VBA001 | Option Explicit が宣言されていない |
警告 |
| VBA002 | On Error Resume Next の使用 |
警告 |
| VBA003 | GoTo の使用(On Error GoTo は除外) |
警告 |
| VBA004 | 最大行長超過(デフォルト: 200文字) | 警告 |
| VBA005 | Dim 宣言後に一度も使用されない変数 |
警告 |
| VBA006 | ネスト深さが閾値を超過(デフォルト: 5) | 警告 |
| VBA007 | Sub/Function の行数が閾値を超過(デフォルト: 100行) | 警告 |
| VBA008 | 括弧の不一致 | エラー |
| VBA009 | End If / End Sub / End Function 等の End 忘れ |
エラー |
設定(cat5dev.toml):
Lint はデフォルトで無効です。有効にするには、ワークスペースルートに cat5dev.toml ファイルを作成します:
- コマンドパレットから
cat5dev.initを実行するか、 - 以下の内容で
cat5dev.tomlを手動作成してください:
[lint]
enabled = true
[lint.rules]
option_explicit = true
on_error_resume_next = true
goto = true
max_line_length = 200 # 0 = 無効
unused_variables = true
max_nesting_depth = 5 # 0 = 無効
max_function_lines = 100 # 0 = 無効
unmatched_parens = true
unmatched_blocks = truecat5dev.toml の変更は保存後すぐに反映されます(再読み込み不要)。
保存時または Shift+Alt+F で VBA コードフォーマッタが自動実行されます。
デフォルトで有効な処理:
- キーワード大文字化(
dim→Dim、end if→End Ifなど) - インデント修正(
Sub、If、For、With、Select Caseなどのブロック) - 行末スペース除去
- 継続行マーカー前スペース追加(
Show(_→Show( _) - 継続行インデント(
_で終わる行の次行は +1 インデント、ただし)のみの行は除外) - 空行正規化(連続2行まで・プロシージャ間に空行1行を保証)
オプション(デフォルト無効):
| オプションフラグ | 説明 |
|---|---|
-normalize-operator-spacing |
x=1+2 → x = 1 + 2 |
-normalize-comma-spacing |
foo(a,b) → foo(a, b) |
-normalize-comment-space |
'comment → ' comment |
-normalize-then-placement |
If x _\n Then → If x Then |
-split-colon-statements |
Dim x: x = 1 → 2行に分割 |
-expand-type-suffixes |
Dim x% → Dim x As Integer |
-normalize-on-error |
On Error スタイル統一 |
Cat5Dev は .vsix ファイルとして配布されています。以下の手順でインストールしてください:
-
.vsixファイルをダウンロード
cat5dev-x.x.x.vsix(またはそれ以降)をリリースページから取得します。 -
VSCode にインストール
VSCode の拡張機能ビュー(Ctrl+Shift+X)を開き、右上の⋯メニューをクリックして VSIX からインストール を選択します。 -
ファイルを選択
ダウンロードした.vsixファイルを選択して、インストールを確認します。
Cat5Dev を初めて使用する前に、CATIA V5 の設定フォルダをバックアップしてください:
- フォルダパス:
%APPDATA%\Dassault Systemes\CATSettings - 理由: まれに CATIA の設定が破損または不適切な状態になることがあります。バックアップがあれば、必要に応じて設定を復元できます。
バックアップ手順:
1. Win+R キーを押して「%APPDATA%」と入力
2. Dassault Systemes\CATSettings に移動
3. 右クリックして「コピー」を選択
4. 安全な場所(デスクトップ、OneDrive など)に貼り付け
5. バックアップフォルダの名前を変更(例:「CATSettings_backup_2026-04-18」)
- CATIA V5 が起動しており、VBA プロジェクトが開いていること
- Windows(
cscript.exe経由の COM オートメーションを使用)
<workspace>/
├── .vscode/
│ └── settings.json # 対象プロジェクトと言語の設定
├── cat5dev.toml # Lint 設定(cat5dev.init で生成)
└── modules/
├── MyModule.bas_utf # 標準モジュール
├── MyClass.cls_utf # クラスモジュール
└── MyForm.frm_utf # ユーザーフォーム
設定は
.vscode/settings.jsonに以下のキーで保存されます:
targetProject— 対象 CATIA VBA プロジェクトの名前language—"ja"は日本語、"en"は英語(デフォルト:"ja")
- 拡張機能をインストール
- VSCode でワークスペースフォルダを開く
- アクティビティバーの Cat5Dev アイコンをクリック
- ⚙️ をクリックして対象の CATIA VBA プロジェクトを選択
- ☁️↓ Pull をクリックして CATIA からモジュールを
modules/フォルダにインポート - VSCode で VBA コードを編集
- ☁️↑ Push をクリックして変更を CATIA に同期
VSCode から Push した後は、CATIA の VBA エディタでプロジェクトを保存してください(VBA エディタ内で ツール > 保存 または Ctrl+S)。
Push は CATIA のインメモリ VBE にモジュールコードを書き込みます。保存せずに CATIA を閉じると、Push した変更はすべて失われます。
VSCode(編集)→ Push → CATIA の VBA エディタで保存 ✅
↓
変更が CATIA ドキュメントに永続化される
- VBA ファイルは UTF-8 エンコーディングで保存され、CATIA のネイティブな Shift-JIS エクスポートと区別するために
_utfサフィックスが付きます - 本拡張機能は COM(
MSAPC.Apc)経由で CATIA V5 の VBE(Visual Basic エディタ)を操作します - VSCode 内でのデバッグ実行は現在サポートされていません。デバッグには CATIA 付属の VBA IDE をご利用ください
CATIA V5 のマクロ開発をいくつかの言語で試してきましたが、最終的に VBA に戻ってきた理由がいくつかあります:
- ネイティブサポート — VBA は CATIA V5 に直接組み込まれています
- 最良の開発環境 — VBE は今でも最も充実した安定した選択肢です
- 驚くほど速い — 多くのケースで VBA が他の選択肢を上回りました
- コンパクトな配布 — 外部ランタイムや依存関係が不要です
VBA という言語が好きかどうか? それはまた別の話です。
MIT
