热线电话:13121318867

登录
2021-04-15 阅读量: 2993
如何将Excel表格中的图片链接直接显示成图片?

要批量的就VBA,少量直接插入图片(本地),然后在位置栏里面粘贴上图片的URL就可以了。

VBA代码可参考如下所示:

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Public Sub downloadandshow()

Application.ScreenUpdating = False

Dim iRow, i, s

Dim savePath

Dim arr As Variant

Set fso = CreateObject("scripting.filesystemobject")

savePath = ThisWorkbook.Path & "\图片"

If fso.folderexists(savePath) Then

fso.deletefolder savePath

End If

MkDir savePath

i = 2

Do While Cells(i, 1) <> ""

URLDownloadToFile 0, Cells(i, 1).Value, savePath & "\" & i & ".jpg", 0, 0

Cells(i, 1).Select

ActiveSheet.Pictures.Insert(savePath & "\" & i & ".jpg").Select

Selection.ShapeRange.LockAspectRatio = msoFalse

Selection.ShapeRange.Height = Rows(i).RowHeight

Selection.ShapeRange.Width = Columns(1).Width

i = i + 1

Loop

Application.ScreenUpdating = True

End Sub


133.3333
0
关注作者
收藏
评论(0)

发表评论

暂无数据