Install
$ agentstack add skill-parry-123-excel-vibe-coder-skill-excel-vibe-coder-skill ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Excel Vibe Coder
Excel VBA 智能编程助手,让 Excel 变成可编程的智能工作簿。
> ⚠️ 执行方式警告:本技能必须使用 write_file + run_shell_command 的方式执行Python代码,严禁使用 python -c "..." 内联代码方式。
核心工具
本 skill 提供 vba_manager.py 工具脚本,封装了所有 VBA 操作功能。
工具位置
{SKILL_DIR}\tools\vba_manager.py
使用方法
通过 run_shell_command 调用,命令格式:
python vba_manager.py [参数...]
返回结果为 JSON 格式,包含 success 字段和具体数据。
命令参考
1. list - 列出所有 VBA 模块
用途:查看工作簿中有哪些模块
命令:
python vba_manager.py list ""
示例:
run_shell_command({
"command": 'python vba_manager.py list "D:\\test.xlsm"',
"cwd": "{SKILL_DIR}\\tools"
})
返回:
{
"success": true,
"file": "test.xlsm",
"modules": [
{"name": "Module1", "type": "模块", "type_id": 1, "lines": 50},
{"name": "Sheet1", "type": "文档", "type_id": 100, "lines": 10}
]
}
2. read - 读取模块代码
用途:查看已有模块的代码内容
命令:
python vba_manager.py read "" ""
示例:
run_shell_command({
"command": 'python vba_manager.py read "D:\\test.xlsm" "Module1"',
"cwd": "{SKILL_DIR}\\tools"
})
返回:
{
"success": true,
"module": "Module1",
"code": "Sub Hello()\n MsgBox \"Hello\"\nEnd Sub"
}
3. write - 写入/覆盖模块
用途:创建新模块或覆盖已有模块
命令:
python vba_manager.py write "" "" ""
示例:
# 先生成代码文件
write_file({
"file_path": "D:\\AgentWorkspace\\temp\\mycode.bas",
"content": '''
Sub HelloFromAI()
MsgBox "Hello from AI!"
End Sub
'''
})
# 然后写入到 Excel
run_shell_command({
"command": 'python vba_manager.py write "D:\\test.xlsm" "AiModule" "D:\\AgentWorkspace\\temp\\mycode.bas"',
"cwd": "{SKILL_DIR}\\tools"
})
返回:
{
"success": true,
"module": "AiModule",
"lines": 3
}
4. delete - 删除模块
用途:删除指定模块
命令:
python vba_manager.py delete "" ""
示例:
run_shell_command({
"command": 'python vba_manager.py delete "D:\\test.xlsm" "TempModule"',
"cwd": "{SKILL_DIR}\\tools"
})
5. run - 运行宏
用途:执行指定的 VBA 宏
命令:
python vba_manager.py run "" "" [参数1] [参数2] ...
示例:
# 无参数
run_shell_command({
"command": 'python vba_manager.py run "D:\\test.xlsm" "AiModule.HelloFromAI"',
"cwd": "{SKILL_DIR}\\tools"
})
# 带参数
run_shell_command({
"command": 'python vba_manager.py run "D:\\test.xlsm" "Module1.AddNumbers" "10" "20"',
"cwd": "{SKILL_DIR}\\tools"
})
返回:
{
"success": true,
"macro": "AiModule.HelloFromAI",
"result": null
}
6. export - 导出模块
用途:将模块导出为 .bas/.cls/.frm 文件
命令:
python vba_manager.py export "" "" ""
示例:
run_shell_command({
"command": 'python vba_manager.py export "D:\\test.xlsm" "Module1" "D:\\backup\\module1.bas"',
"cwd": "{SKILL_DIR}\\tools"
})
7. import - 导入模块
用途:从文件导入模块到 Excel
命令:
python vba_manager.py import "" "" [新名称]
示例:
# 保持原名
run_shell_command({
"command": 'python vba_manager.py import "D:\\test.xlsm" "D:\\code\\utils.bas"',
"cwd": "{SKILL_DIR}\\tools"
})
# 重命名
run_shell_command({
"command": 'python vba_manager.py import "D:\\test.xlsm" "D:\\code\\utils.bas" "MyUtils"',
"cwd": "{SKILL_DIR}\\tools"
})
完整工作流示例
场景:AI 生成代码并运行
# Step 1: 生成 VBA 代码
write_file({
"file_path": "D:\\AgentWorkspace\\temp\\generated_code.bas",
"content": '''
Sub ProcessData()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
' 统计 A 列非空单元格
Dim count As Long
Dim cell As Range
For Each cell In ws.Range("A1:A100")
If cell.Value <> "" Then
count = count + 1
End If
Next cell
MsgBox "A列共有 " & count & " 个非空单元格", vbInformation
End Sub
'''
})
# Step 2: 写入到 Excel
run_shell_command({
"command": 'python vba_manager.py write "D:\\data\\report.xlsm" "DataProcessor" "D:\\AgentWorkspace\\temp\\generated_code.bas"',
"cwd": "{SKILL_DIR}\\tools"
})
# Step 3: 运行宏
run_shell_command({
"command": 'python vba_manager.py run "D:\\data\\report.xlsm" "DataProcessor.ProcessData"',
"cwd": "{SKILL_DIR}\\tools"
})
错误处理
所有命令返回 JSON 格式,通过 success 字段判断:
import json
result = run_shell_command({...})
data = json.loads(result)
if data["success"]:
print(f"✅ 成功: {data}")
else:
print(f"❌ 失败: {data['error']}")
前置要求
- Excel 设置:
- 文件 → 选项 → 信任中心 → 信任中心设置
- 宏设置 → 勾选 "信任对 VBA 工程对象模型的访问"
- 文件格式:
- 必须使用
.xlsm格式(启用宏的工作簿) .xlsx无法保存 VBA 代码
- 依赖库:
``bash pip install pywin32 ``
模块类型说明
| type_id | 类型 | 说明 | |---------|------|------| | 1 | 模块 | 标准代码模块(最常用) | | 2 | 类模块 | 面向对象类定义 | | 3 | 窗体 | 用户窗体(带界面) | | 100 | 文档 | Sheet/Workbook 代码 |
最佳实践
- 模块命名:使用英文或拼音,不含空格
- 代码备份:重要操作前先用
export备份 - 错误处理:生成的代码建议加
On Error处理 - 保存习惯:
write命令会自动保存,但重要操作后建议手动确认
用户提示语
当用户说以下话时触发本 skill:
- "帮我写个 VBA 宏..."
- "在这个 Excel 里添加功能..."
- "运行我的宏..."
- "读取/修改 VBA 代码..."
- "导出 VBA 模块..."
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: parry-123
- Source: parry-123/excel-vibe-coder-skill
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.