I want to import a group of images into excel as pictures. I got a macro offline but it imports the file names not the image itself.
So here is the macro I'm currently using:
So the result I'm getting from this is
Image01.jpg
Image02.jpg
Image03.jpg
Image04.jpg
.....
So this is doing exactly what I want it to except I want the images imported rather than the file names. Any suggestions?
Notes:
All files have the same name, the only thing that changes is the number and the number is always to digit. So Image01.jpg NOT image1.jpg
All files are in the same folder.
Any help would be much appreciated. Let me know if further clarification is needed.
So here is the macro I'm currently using:
Code:
Sub JPGList()Dim FSO As Object '<---FileSystemObject
Dim FOL As Object '<---Folder
Dim FIL As Object '<---File
Dim aryJPGList
'// Change to suit//
Const strPath As String = "C:\Documents and Settings\user\Desktop\Sample 2"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FOL = FSO.GetFolder(strPath)
ReDim aryJPGList(0 To 0)
For Each FIL In FOL.Files
If FIL.Type = "JPEG Image" Then
ReDim Preserve aryJPGList(1 To UBound(aryJPGList) + 1)
aryJPGList(UBound(aryJPGList)) = FIL.Name
End If
Next
'// Pick a place to plant the list//
ActiveSheet.Range("B7").Resize(UBound(aryJPGList)).Value = Application.Transpose(aryJPGList)
End Sub
So the result I'm getting from this is
Image01.jpg
Image02.jpg
Image03.jpg
Image04.jpg
.....
So this is doing exactly what I want it to except I want the images imported rather than the file names. Any suggestions?
Notes:
All files have the same name, the only thing that changes is the number and the number is always to digit. So Image01.jpg NOT image1.jpg
All files are in the same folder.
Any help would be much appreciated. Let me know if further clarification is needed.