excel 将图片的链接URL 显示为图片 转

原帖: http://www.mrexcel.com/forum/excel-questions/604604-insert-image-url-images-into-cells-2.html

  1. 如下VBA脚本将c1单元格内图片url链接在单元B1内把图片显示出来

Sub Test()
Dim Pic As Picture
Application.ScreenUpdating = False
With ActiveSheet.Range("C1")
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, -1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Application.ScreenUpdating = True
End Sub

  1. 整列的图片url显示为图片

Sub Test()
Dim Rng As Range
Dim Cell As Range
Dim Pic As Picture
Application.ScreenUpdating = False
Set Rng = Range("C1:C" & Range("c" & Rows.Count).End(xlUp).Row)
For Each Cell In Rng
With Cell
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, -1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Next Cell
Application.ScreenUpdating = True
End Sub

posted @   八路逆袭寡妇村  阅读(943)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· [AI/GPT/综述] AI Agent的设计模式综述
www.zxzidian.com
点击右上角即可分享
微信分享提示