excel-vba-modifier
2
总安装量
2
周安装量
#72019
全站排名
安装命令
npx skills add https://github.com/rukkha1024/elderly-balance-assessment --skill excel-vba-modifier
Agent 安装分布
opencode
2
gemini-cli
2
claude-code
2
github-copilot
2
windsurf
2
codex
2
Skill 文档
Excel VBA Modifier Skill
Safe VBA code modification with xlwings
Overview
Automates VBA code modifications while ensuring safety:
- Verify Trust Center allows programmatic VBA access
- Read VBA module code from .xlsm files
- Write/modify VBA module code safely
- Run test macros to validate changes
- Automatic backup before modifications
When to Use
- Modifying VBA code: Safe xlwings-based editing
- Testing macro changes: Run macros to validate
- Debugging VBA: Read module code without manual editing
- Batch updates: Apply changes to multiple macros
- Following safety rules: Automatic backup and validation
Usage
# Check Trust Center permissions
conda run -n excel python script/modify_vba.py check-trust perturb_inform.xlsm
# Read a VBA module
conda run -n excel python script/modify_vba.py read perturb_inform.xlsm Module2
# Write/modify a VBA module (from file)
conda run -n excel python script/modify_vba.py write perturb_inform.xlsm Module2 new_code.vba
# Run a macro to test
conda run -n excel python script/modify_vba.py run perturb_inform.xlsm BuildMetaSummary
Features
Trust Center Checking
conda run -n excel python script/modify_vba.py check-trust file.xlsm
Output:
â Trust Center check passed
â VBA project access allowed
Reading VBA Code
conda run -n excel python script/modify_vba.py read file.xlsm Module2
Outputs module code to console (can redirect to file).
Writing VBA Code
# Write from file
conda run -n excel python script/modify_vba.py write file.xlsm Module2 new_code.vba
# Automatically creates backup first
# Then replaces module with new code
Running Macros
# Test macro after modification
conda run -n excel python script/modify_vba.py run file.xlsm BuildMetaSummary
# With arguments (if applicable)
conda run -n excel python script/modify_vba.py run file.xlsm Sub1 arg1 arg2
Safety Features
â Automatic backup before modifications â Trust Center validation â Test macro execution â Error handling and rollback â Windows only (COM access)
Integration with Other Skills
- excel-backup-manager: Auto-backup before writes
- excel-inspector: Understand VBA structure
- excel-na-utils: Helper functions for VBA code
Requirements
- OS: Windows only (xlwings COM access)
- Package: xlwings
- Trust Center: Must allow programmatic VBA access
- Excel: Installed and configured
Error Handling
| Error | Solution |
|---|---|
| Trust Center blocked | Enable in Excel: File > Options > Trust Center |
| Module not found | Use excel-inspector to list modules |
| Write failed | Check file isn’t open in Excel |
| Macro failed | Check syntax in new VBA code |
Workflow
User request
â
Check Trust Center
â
Create backup (via excel-backup-manager)
â
Read current module
â
Write new module
â
Run test macro
â
Report success/failure
Files
vba_modifier.py: Core VBA modification logictrust_center_checker.py: Trust Center validation- CLI:
script/modify_vba.py