|
|
本帖最后由 quqiyuan 于 2025-3-11 16:20 编辑
代码如下。。。
Sub添加图片2()
Dim r
Dim maxR%
Dim shp As Shape
Dim rng As Range
Dim f$, p$
Set wb = ThisWorkbook
Set sht = wb.Sheets("sheet2")
With sht
p = wb.Path & "\图片\"
f = p & .Cells(4, 2) & "-" & .Cells(5, 2) & ".jpg"
f_exist = Dir(f)
If f_exist <> "" Then
Set rng1 = .[b11].MergeArea
For Each shp In .Shapes
If Round(shp.Top, 2) = Round(rng1.Top, 2) Then
shp.Delete
End If
Next
Set shp = .Shapes.AddPicture(f, _
True, True, rng1.Left, rng1.Top, rng1.Width, rng1.Height)
shp.Placement = xlMoveAndSize '锟斤拷锟斤拷应锟斤拷小
shp.LockAspectRatio = msoFalse '取锟斤拷锟斤拷锟斤拷锟捷猴拷锟?
Else
MsgBox f & "锟斤拷锟斤拷锟节o拷锟斤拷"
End If
End With
Beep
End Sub
|
评分
-
1
查看全部评分
-
|