[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Get Pics by date taken

Posted on 2008-11-07
2
Medium Priority
?
588 Views
Last Modified: 2013-12-02
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?
0
Comment
Question by:wcmash
2 Comments
 
LVL 26

Expert Comment

by:tigin44
ID: 22907421
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...
0
 
LVL 6

Accepted Solution

by:
alex_paven earned 2000 total points
ID: 22911061
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))
Next
f.Sort(New FIDateComparer())
 
For Each fi As FileInfo In f
	Debug.Print(fi.Name & vbTab & fi.CreationTime)
Next

Open in new window

0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question