Get Pics by date taken

Ok lets see if i can explain this. I have a publisher file that has soem pic boxes on the document.  what we are doing now is double clicking on the Picture box and choosing the pic we want out of the directory and then going to the next box and doing the same thing. I would like to automate this with VB and have it ask me what directory then for it to grab each pic in that directory by the date and time taken and put them in order. Is this possible?
Who is Participating?
alex_pavenConnect With a Mentor Commented:
Get all files in the selected folder and store their details in an array; then order the array by the creation date. A simple example (VB2005 tested):

Public Class FIDateComparer
	Inherits Comparer(Of FileInfo)
	Public Overrides Function Compare(ByVal x As System.IO.FileInfo, ByVal y As System.IO.FileInfo) As Integer
		Return x.CreationTime.CompareTo(y.CreationTime)
	End Function
End Class
Dim f As New List(Of FileInfo)
Dim s() As String = Directory.GetFiles("c:\")
For Each n As String In s
	f.Add(New FileInfo(n))
f.Sort(New FIDateComparer())
For Each fi As FileInfo In f
	Debug.Print(fi.Name & vbTab & fi.CreationTime)

Open in new window

Every file has a tag that contains the creation date of that file. You can select your file by using this property of the file...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.