|
批量插入图片的VBA如何修改把图片的连接改为图片,使用文件发送到其他电脑都能看到
Sub insertpic()
Dim r As Long, i As Long
Dim path As String
Call DeletePic
r = ActiveSheet.[B65536].End(xlUp).row
path = ThisWorkbook.path & "\pic"
For i = 1 To r
If Dir(path & "\" & ActiveSheet.Cells(i, 2) & ".jpg") <> "" Then
With ActiveSheet.Pictures.Insert(path & "\" & ActiveSheet.Cells(i, 2) & ".jpg").ShapeRange
.LockAspectRatio = msoFalse
.Left = ActiveSheet.Cells(i, 1).Left
.Top = ActiveSheet.Cells(i, 1).Top
.Height = ActiveSheet.Cells(i, 1).Height
.Width = ActiveSheet.Cells(i, 1).Width
End With
End If
Next i
End Sub
|
|