|
- Sub demo1()
- Dim strPath$, strName$
- Dim l As Byte, i As Byte, j As Byte
- Dim strNewName$
- strPath = ThisWorkbook.Path & Application.PathSeparator
- strName = Dir(strPath & "*.*", vbDirectory)
- Do While Len(strName)
- strNewName = ""
- If (GetAttr(strPath & strName) And vbDirectory) = vbDirectory Then
- l = Val(strName)
- If l Then
- i = l \ 27
- j = (l - 1) Mod 26 + 1
- If i Then strNewName = strNewName & Chr(64 + i)
- If j Then strNewName = strNewName & Chr(64 + j)
- Name strPath & strName As strPath & strNewName
- Debug.Print strName, strNewName
- End If
- End If
- strName = Dir
- Loop
- MsgBox "重命名完成"
- End Sub
复制代码 不好意思,没有测试到其他的数据,刚测了从1-50. |
|