[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] test()
[color=green]'Set up a reference to the Windows Script Host Object Model in the Visual Basic Editor[/color]
[color=green]'Tools > References > Windows Script Host Object Model[/color]
[color=darkblue]Dim[/color] objFSO [color=darkblue]As[/color] FileSystemObject
[color=darkblue]Dim[/color] objFolder [color=darkblue]As[/color] Folder
[color=darkblue]Dim[/color] objFile [color=darkblue]As[/color] File
[color=darkblue]Dim[/color] wks [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] txtbox [color=darkblue]As[/color] Shape
[color=darkblue]Dim[/color] strPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] arrMyFiles() [color=darkblue]As[/color] [color=darkblue]Variant[/color]
[color=darkblue]Dim[/color] Ans [color=darkblue]As[/color] [color=darkblue]Variant[/color]
[color=darkblue]Dim[/color] Num [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] Cnt [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] i [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] j [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] temp1 [color=darkblue]As[/color] [color=darkblue]Variant[/color]
[color=darkblue]Dim[/color] temp2 [color=darkblue]As[/color] [color=darkblue]Variant[/color]
Ans = Application.InputBox(Prompt:="How many recent images would you like to import?", Title:="How man?", Type:=1)
[color=darkblue]If[/color] Ans = [color=darkblue]False[/color] [color=darkblue]Then[/color] [color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=green]'Change the path to the folder accordingly[/color]
strPath = "C:\Users\Domenic\Desktop\Test\"
[color=darkblue]Set[/color] objFSO = CreateObject("Scripting.FileSystemObject")
[color=darkblue]Set[/color] objFolder = objFSO.GetFolder(strPath)
[color=darkblue]For[/color] [color=darkblue]Each[/color] objFile [color=darkblue]In[/color] objFolder.Files
Cnt = Cnt + 1
[color=darkblue]ReDim[/color] [color=darkblue]Preserve[/color] arrMyFiles(1 [color=darkblue]To[/color] 2, 1 [color=darkblue]To[/color] Cnt)
arrMyFiles(1, Cnt) = objFile.DateCreated
arrMyFiles(2, Cnt) = objFile.Path
[color=darkblue]Next[/color] objFile
[color=darkblue]For[/color] i = 1 [color=darkblue]To[/color] [color=darkblue]UBound[/color](arrMyFiles, 2) - 1
[color=darkblue]For[/color] j = i + 1 [color=darkblue]To[/color] [color=darkblue]UBound[/color](arrMyFiles, 2)
[color=darkblue]If[/color] arrMyFiles(1, i) < arrMyFiles(1, j) [color=darkblue]Then[/color]
temp1 = arrMyFiles(1, j)
temp2 = arrMyFiles(2, j)
arrMyFiles(1, j) = arrMyFiles(1, i)
arrMyFiles(2, j) = arrMyFiles(2, i)
arrMyFiles(1, i) = temp1
arrMyFiles(2, i) = temp2
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]Next[/color] j
[color=darkblue]Next[/color] i
[color=darkblue]If[/color] Ans > [color=darkblue]UBound[/color](arrMyFiles, 2) [color=darkblue]Then[/color]
Num = [color=darkblue]UBound[/color](arrMyFiles, 2)
[color=darkblue]Else[/color]
Num = Ans
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]For[/color] i = 1 To Num
[color=darkblue]Set[/color] wks = Worksheets.Add(before:=Worksheets(i))
[color=darkblue]Set[/color] txtbox = wks.Shapes.AddTextbox(msoTextOrientationHorizontal, 195, 63, 292.5, 207)
[color=darkblue]With[/color] txtbox.Fill
.Visible = msoTrue
.PresetTextured msoTexturePapyrus
.TextureTile = msoTrue
.TextureOffsetX = 0
.TextureOffsetY = 0
.TextureHorizontalScale = 1
.TextureVerticalScale = 1
.TextureAlignment = msoTextureTopLeft
.UserPicture arrMyFiles(2, i)
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]Next[/color] i
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]