Sub AAA()
On Error Resume Next
Dim t As String, fd
Dim MR As Range
Set fd = Application.FileDialog(msoFileDialogFolderPicker) '允许用户选择一个文件夹
If fd.Show = -1 Then
t = fd.SelectedItems(1) '选择之后就记录这个文件夹名称
Else
Exit Sub '否则就退出程序
End If
p = InputBox("请选择图片插入位置,上,下,左,右依次用1,2,3,4代替", "请选择位置")
Set fso = CreateObject("scripting.filesystemobject")
For Each MR In Selection
If Not IsEmpty(MR) Then
pic = t & "\" & MR.Value & ".jpg"
If fso.fileexists(pic) Then
MR.Select
If
Excel宏代码插入图片
于 2023-12-19 16:56:43 首次发布