excel vb 宏,插入图片去除本来没有的边框
Sub插入图片到单元格()OnErrorResumeNextDimMRAsRangeForEachMRInSelectionIfNotIsEmpty(MR)ThenFor...
Sub 插入图片到单元格()
On Error Resume Next
Dim MR As Range
For Each MR In Selection
If Not IsEmpty(MR) Then
For i = 3 To 6 Step 1
Cells(MR.Row, MR.Column + i).Select
ML = Selection.Left + 3
MT = Selection.Top + 3
MW = Selection.Width - 6
MH = Selection.Height - 6
pths = ActiveWorkbook.Path & "\pic\" & MR.Value & "-" & i - 3 & ".jpg"
If Dir(pths) > "" Then
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
Selection.ShapeRange.Fill.UserPicture pths
End If
Next
End If
Next
End Sub
上一行图片都存在边框,实际图片如第二行,是没有边框的,如何修改语句 展开
On Error Resume Next
Dim MR As Range
For Each MR In Selection
If Not IsEmpty(MR) Then
For i = 3 To 6 Step 1
Cells(MR.Row, MR.Column + i).Select
ML = Selection.Left + 3
MT = Selection.Top + 3
MW = Selection.Width - 6
MH = Selection.Height - 6
pths = ActiveWorkbook.Path & "\pic\" & MR.Value & "-" & i - 3 & ".jpg"
If Dir(pths) > "" Then
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
Selection.ShapeRange.Fill.UserPicture pths
End If
Next
End If
Next
End Sub
上一行图片都存在边框,实际图片如第二行,是没有边框的,如何修改语句 展开
1个回答
展开全部
If Dir(pths) > "" Then
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.Fill.UserPicture pths
End If
追加“Selection.ShapeRange.Line.Visible = msoFalse”这一行代码。
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.Fill.UserPicture pths
End If
追加“Selection.ShapeRange.Line.Visible = msoFalse”这一行代码。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询