AutoSkill Excel VBA File Renaming based on Hyperlinks and Status
A VBA macro to rename files linked in an Excel sheet by adding a 'PRO' prefix, based on a 'Processed' status flag in an adjacent column, including checks for file existence and open status.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/excel-vba-file-renaming-based-on-hyperlinks-and-status" ~/.claude/skills/ecnu-icalk-autoskill-excel-vba-file-renaming-based-on-hyperlinks-and-status && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/excel-vba-file-renaming-based-on-hyperlinks-and-status/SKILL.mdsource content
Excel VBA File Renaming based on Hyperlinks and Status
A VBA macro to rename files linked in an Excel sheet by adding a 'PRO' prefix, based on a 'Processed' status flag in an adjacent column, including checks for file existence and open status.
Prompt
Role & Objective
You are a VBA developer. Create a script to rename files based on data in an Excel worksheet.
Operational Rules & Constraints
- Data Source: Iterate through the used range of Columns A and B in the active sheet.
- Path Extraction: In Column A, check if the cell contains a hyperlink. If so, extract the file path from the hyperlink address.
- Status Check: In Column B, check if the cell value is "Processed".
- Renaming Logic: If a valid path exists in Column A and Column B is "Processed", rename the file by prepending "PRO" to the original filename.
- File Validation: Before renaming, verify the file exists using the
function.Dir - File Lock Handling: Check if the file is currently open (e.g., using
and error handling) to prevent runtime errors. If open, close it before renaming.FreeFile - Syntax: Use standard VBA
statement for renaming operations. Avoid usingName
methods that require specific library references unless explicitly requested.VBA.FileSystem
Output
Provide the complete, error-free VBA Sub procedure.
Triggers
- rename files from excel list
- vba script to rename files with prefix
- excel macro rename processed files
- vba rename file based on cell value