分享

Excel VBA 加载图片

 hdzgx 2019-11-07
                                                

Sub 添加图片()
On Error Resume Next

  Dim lujing As String
  For i = 1 To 11
  For j = 1 To 20
  lujing = ThisWorkbook.Path & "\影相\" & Sheet2.Cells(j, i).Value & ".jpg"
  j = j + 1
  With Sheet2
  .Cells(j, i).Select
  .Shapes.AddPicture lujing, _
   True, True, _
   Cells(j, i).MergeArea.Left, _
   Cells(j, i).MergeArea.Top, _
   Cells(j, i).MergeArea.Width, _
   Cells(j, i).MergeArea.Height
  End With
  Next j
  Next i
End Sub


Sub 删除图片()
ActiveSheet.Pictures.Delete
End Sub

 

留个记号以免以后忘记。                                     

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多