'复制后,新文件名格式是:原文件名_次数.jpg
Sub copyPic()
Dim fso
Dim picPath$, copyPath$, oldFile$, newFile$
Dim A, i%, j%
Set fso = CreateObject("scripting.filesystemobject")
picPath = ThisWorkbook.Path & "\图片" '手动指定
copyPath = ThisWorkbook.Path & "\复制" '手动指定
If fso.FolderExists(copyPath) Then fso.DeleteFolder copyPath
fso.createfolder copyPath
A = Range("a1").CurrentRegion
For i = 1 To UBound(A)
For j = 1 To A(i, 2)
oldFile = picPath & "\" & A(i, 1) & ".jpg"
newFile = copyPath & "\" & A(i, 1) & "_" & j & ".jpg"
fso.copyFile oldFile, newFile
Next j
Next i
End Sub
复制图片.rar
(127.34 KB, 下载次数: 18)