Hi there,
I should start by saying this is for Excel 2004 on a mac.
Is there any way to insert multiple jpeg files into separate cells easily?
I have a folder with 400+ jpegs, I want image 1 to fit into cell 1A, then image 2 to fit in cell 2A and so on down the left hand side of the worksheet.
I'm reasonably new to excel and I've never tried using macros before, just trying to get my head around it, I only started last night.
I have to do this quite often, the number of jpegs and the name of the files in the folder will change but the folder name can stay the same. At present the folder is on my desktop, named 'thumbnails'.
Ideally the jpegs would also resize with the cells if they are changed at any point. At the moment I'm doing this one by one.
I found the following code on a different forum if it's any help, but I think this also involves resizing which I don't need:
Public Sub MacInsertPhotos()
Const MyPath = "Macintosh HD:Users:R:Documents:Atlas:Photos:"
Const cnWidth As Long = 200
Dim FName As String
Dim nTop As Long
Dim Sh As Shape
FName = Dir(MyPath, vbNormal)
With Worksheets("Photos").Pictures
Do While Len(FName) > 0
If UCase(FName) Like "*.JPG" Then
With .Insert(MyPath & FName)
.Top = nTop
.Left = 0
.Height = .Height * cnWidth / .Width
.Width = cnWidth
nTop = .BottomRightCell.Offset(1).Top
End With
End If
FName = Dir
Loop
End With
End Sub
If anyone can assist it would be a HUGE help.
Many thanks in advance,
Rich.
Bookmarks