在MS Excel中根据单元格值显示来自文件夹的图像
我想在Microsoft Excel中显示相关单元格的图像库。
例如,
A1 = "mypic.png" B1 cell should show mypic.png A2 = "anotherpic.png" B2 cell should show anotherpic.png
图片在同一个目录中。
有没有办法做到这一点?
使用此代码,您可以在单元格F20
插入一个图像与存储在单元格A1
的path。 使用完整的path,如D:\one.jpg
。 用您的Tabelle1
更改Tabelle1
。
Sub Test() Dim objPicture As Picture With Tabelle1.Cells(20, 6) ' Picture starts in cell F20 -> change as you need Set objPicture = .Parent.Pictures.Insert(Tabelle1.Cells(1, 1).Value) objPicture.Top = .Top objPicture.Left = .Left objPicture.Height = 150 objPicture.Width = 150 End With End Sub