Hallo,
I'm creating a reporting system in excel using macro's. What I've done so far is a csv file is imported, this contains an image name, images are imported using these image names. My problem is that all the images goes and sits on Cell A4, I want each image to import next to the image name.
this is my code to import the images:
Sub InsertPictures()
Dim row As Long
Dim picPath As String
Dim Picture As Object
Dim dHeight As Double
Dim dWidth As Double
row = 1
On Error Resume Next
While Cells(row, 1) <> ""
Cells(row, 5).Select
picPath = "D:\Asbestikum Design Files\Weekly Reports\Log & Slides\Slides\" + Cells(row, 4)
ActiveSheet.Pictures.Insert(picPath).Select
Set Picture = Selection
'set cell height to picture size
With Picture
dWidth = .Width
dHeight = .Height
.Width = 100
.Height = 75
End With
Picture.Top = Picture.TopLeftCell.Top
Picture.Left = Picture.TopLeftCell.Left
Picture.TopLeftCell.EntireRow.RowHeight = Picture.Height
row = row + 1
Wend
End Sub
Bookmarks