我在OneDrive上存储了一个Excel文件,并且在同一驱动器上存储了一些图片。图片通过PowerApp上传。在我的excel文件中,我只能看到文件路径,而不是实际图片,有什么方法可以通过文件路径显示图片?路径不满(从点开始(,看起来像这样:"。
您可以在VBA中做类似的事情。
Sub InstallPictures()
Dim i As Long, v As String
On Error Resume Next
For i = 2 To 10
v = Cells(i, "J").Value
If v = "" Then Exit Sub
With ActiveSheet.Pictures
.Insert (v)
'image position left and top
.Left = Cells(i, "J").Left
.Top = Cells(i, "J").Top
'set cell height to match image
.Cells(i).EntireRow.RowHeight = .Height
End With
Next i
On Error GoTo 0
End Sub
这是来自@gary的学生在这里找到的一个很好的逐步答案,我该如何在Excel单元格中显示为图像?添加了设置图片位置和行高以匹配图像的选项。
p.s。:您可能需要从OneDrive中 </> Embed
图像才能具有稳定的URL。(Don't know if this has changed)