
Excel Vba Modifier
Safely read, replace, and test VBA in Excel workbooks using xlwings with Trust Center checks and mandatory backups on Windows.
Overview
Excel VBA Modifier is an agent skill for the Build phase that safely reads, writes, and runs Excel VBA modules on Windows using xlwings with Trust Center and backup gates.
Install
npx skills add https://github.com/rukkha1024/elderly-balance-assessment --skill excel-vba-modifierWhat is this skill?
- Trust Center validation before any VBA read or write via trust_center_checker
- Read, write, and run_macro flows backed by vba_modifier.py and modify_vba.py CLI
- Mandatory backup discipline with excel-backup-manager before writes
- Windows-only xlwings COM requirement with closed-workbook safety rules
- Conda-run CLI verbs: check-trust, read, write, run for agent-driven pipelines
- Five core safety rules including backup-first and Windows-only COM
- CLI exposes check-trust, read, write, and run operations
Adoption & trust: 1 installs on skills.sh; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You must change Excel macro code programmatically but fear bricking .xlsm files or violating Trust Center policies.
Who is it for?
Windows-based solo builders automating legacy Excel workbooks with Python and conda-managed xlwings.
Skip if: macOS/Linux-only workflows, greenfield web apps that should replace Excel, or edits without backup and Trust Center approval.
When should I use this skill?
You need to read, update, or test VBA in an Excel .xlsm on Windows with xlwings after Trust Center validation.
What do I get? / Deliverables
You get verified read/write macro cycles with backup-first discipline and a test macro run to confirm the module still executes.
- Updated VBA module content in target .xlsm
- Macro execution verification output
Recommended Skills
Journey fit
Excel VBA automation is Build → integrations when you wire Python/xlwings into legacy .xlsm tooling rather than shipping a standalone SaaS API. Integrations subphase fits COM bridges, macro execution, and coupling to excel-backup-manager—external process control over Office binaries.
How it compares
Office integration skill with enforced backup—not ad-hoc copy-paste of VBA in chat.
Common Questions / FAQ
Who is excel-vba-modifier for?
Indie developers and analysts who own .xlsm tools on Windows and want agents to apply vetted VBA patches through xlwings and a CLI.
When should I use excel-vba-modifier?
During Build integrations work when you need to extract Module2, deploy new_code.vba, and run BuildMetaSummary after Trust Center check on a closed workbook.
Is excel-vba-modifier safe to install?
Review the Security Audits panel on this Prism page; the skill writes to workbooks and runs macros—only use on copies until backups pass and Trust Center is explicitly configured.
SKILL.md
READMESKILL.md - Excel Vba Modifier
# Excel VBA Modifier xlwings를 사용한 안전한 VBA 코드 수정. ## 주요 기능 - **Trust Center 검증**: VBA 접근 권한 확인 - **모듈 읽기**: VBA 모듈 코드 추출 - **모듈 쓰기**: VBA 코드 수정/교체 - **매크로 실행**: 테스트 매크로 실행 - **자동 백업**: 수정 전 자동 백업 (excel-backup-manager 연동) ## 사용법 ### Python에서 ```python from vba_modifier import read_vba_module, write_vba_module, run_macro # VBA 읽기 code = read_vba_module('perturb_inform.xlsm', 'Module2') print(code) # VBA 쓰기 (항상 백업 먼저!) with open('new_code.vba', 'r') as f: new_code = f.read() write_vba_module('perturb_inform.xlsm', 'Module2', new_code) # 매크로 실행 run_macro('perturb_inform.xlsm', 'BuildMetaSummary') ``` ### CLI에서 ```bash # Trust Center 검증 conda run -n excel python script/modify_vba.py check-trust perturb_inform.xlsm # 모듈 읽기 conda run -n excel python script/modify_vba.py read perturb_inform.xlsm Module2 # 모듈 쓰기 (백업 필수!) conda run -n excel python script/modify_vba.py write perturb_inform.xlsm Module2 new_code.vba # 매크로 실행 conda run -n excel python script/modify_vba.py run perturb_inform.xlsm BuildMetaSummary ``` ## 파일 | 파일 | 설명 | |------|------| | `SKILL.md` | Skill 메타데이터 | | `vba_modifier.py` | VBA 읽기/쓰기 핵심 로직 | | `trust_center_checker.py` | Trust Center 검증 | | `README.md` | 이 파일 | ## 안전성 규칙 ✓ **항상 백업 먼저**: `excel-backup-manager` 사용 ✓ **Trust Center 확인**: 수정 전 권한 검증 ✓ **테스트 매크로 실행**: 수정 후 검증 ✓ **Windows 전용**: xlwings COM 접근 필요 ✓ **파일 체크**: 수정 중 파일 열려있으면 안됨 ## Trust Center 설정 Windows Excel에서 VBA 접근을 허용하려면: 1. Excel 실행 2. **파일** > **옵션** > **보안 센터** 3. **보안 센터 설정** 4. **매크로 설정** 탭에서: - ✓ **모든 매크로 사용** 또는 - ✓ **알림을 표시하고 사용 안 함 매크로 사용** 5. **신뢰할 수 있는 게시자** 탭에서: - ✓ **VBA 프로젝트 개체 모델에 대한 신뢰할 수 있는 액세스 허용** 6. **확인** ## 워크플로우 예시 ```python from backup_manager import create_backup, restore_backup from vba_modifier import read_vba_module, write_vba_module, run_macro from trust_center_checker import check_trust_center_windows # 1. Trust Center 검증 allowed, msg, sol = check_trust_center_windows() if not allowed: raise RuntimeError(f"VBA access blocked: {msg}") # 2. 백업 생성 backup = create_backup('perturb_inform.xlsm') try: # 3. 현재 코드 읽기 old_code = read_vba_module('perturb_inform.xlsm', 'Module2') # 4. 새 코드 쓰기 with open('new_code.vba', 'r') as f: new_code = f.read() write_vba_module('perturb_inform.xlsm', 'Module2', new_code) # 5. 테스트 매크로 실행 run_macro('perturb_inform.xlsm', 'BuildMetaSummary') print("✓ VBA modification successful") except Exception as e: print(f"❌ Error: {e}") # 6. 오류 시 복원 restore_backup(backup) raise ``` ## 다른 Skills와의 연결 - **excel-backup-manager**: 수정 전 자동 백업 - **excel-inspector**: 모듈 구조 파악 - **excel-na-utils**: VBA 헬퍼 함수 ## 필수 패키지 ```bash conda run -n excel pip install xlwings ``` ## 주의사항 ⚠️ **Windows 전용**: macOS/Linux에서는 VBA 접근 불가 ⚠️ **파일 미접속**: 수정 중 파일이 Excel에 열려있으면 안됨 ⚠️ **백업 필수**: 항상 수정 전 백업 생성 ⚠️ **테스트 필수**: 수정 후 매크로 실행 테스트 필수 --- name: excel-vba-modifier description: Safely modify Excel VBA code using xlwings. Checks Trust Center permissions, reads/writes modules, and runs test macros. Always creates backups before modifications. --- # 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 ```bash # 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 V