|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 批量插图()
off = Application.Version
Dim ff
Set fso = VBA.CreateObject("Scripting.FileSystemObject")
tr = ActiveCell.Row: tc = ActiveCell.Column
filetoopen = Application.GetOpenFilename("JPG Files (*.JPG), *.JPG", , , , True)
For Each ff In filetoopen
Cells(tr, tc).Select
If Application.Version <> "11.0" Then
ActiveSheet.Pictures.Insert(ff).Cut
Cells(tr, tc).Select
ActiveSheet.PasteSpecial Format:="图片 (JPEG)"
Else
ActiveSheet.Pictures.Insert(ff).Select
End If
t = fso.GetParentFolderName(ff)
mp = t & "\移入"
If Dir(mp, vbDirectory) = "" Then MkDir (mp)
fso.GetFile(ff).Move mp & "\" & fso.GetFile(ff).Name
Cells(tr + 14, tc) = ff1
tc = tc + 60
If tc = 182 Then
tr = tr + 14
tc = 2
End If
Next ff
Set fso = Nothing
Application.CommandBars("Picture").Visible = False
End Sub
|
评分
-
1
查看全部评分
-
|