Graham Mayor

... helping to ease the lives of Microsoft Word users.


Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Modify the Date Properties of Files Stored in Windows

This process does not work in the Mac version of Word and has not been tested with the 64 bit version of Office, though it should work with that version.

When a file is saved under the Windows filing system, amongst the file properties associated with the saved file are the date of creation, the date of last modification and the date the file was last accessed. There are assorted utilities available to allow users to change one or more of these dates, which immediately suggests that the dates cannot be relied upon evidentially is indication of when the file was created, modified or accessed.

However my requirement was a little different, and I could find nothing available that would fulfil my particular requirement, which was to allow files to be sorted by date/time order in Windows File Explorer, with the date/time order matching the filename order.

While researching the possibilities, I came across some Excel VBA code produced by Chip Pearson and published on his web site.

I tend to work primarily in Word and so while this project could just as easily have been developed in Excel, I felt that using Word as a vehicle to host the code made more sense.

The project has nothing really to do with Word (or Excel for that matter). It is intended to process files saved in Windows filing system, and in my case audio and video related files.

Take the following example. The files are sorted in date/time order. Not unreasonably, as they were produced at different times, the sort order doesn't reflect the alphabetical order, which was the aim of the exercise, so that (in my case) when viewed via my DNLA client, the files were displayed in the order they appear below. With, for example, TV series, intended to be viewed in order, this looks untidy and leads to confusion.

The template I produced can be opened and the process run from the buttons it places on the Developer tab of the ribbon.

Note that the Developer Tab may not be displayed on the Word ribbon by default. It can be activated from Word's Options > Customize Ribbon options.

The template can also be used as an add-in if, like me, you need to make frequent use of it and it comes with a self extracting installer to facilitate that.

The first time the process is run, following my usual disclaimer, the template prompts for the folder containing the files to process. When a folder is selected, all the files in that folder are displayed in a list box, and the folder path is shown on a button above the list box, which can be used to change the folder.

The folder selection and the display of the disclaimer panel are retained for re-use until the folder is changed by using the red coloured reset button on the main dialog.

Beneath the list box is a button to sort the list alphabetically and an associated check box to reverse the sort order if required.

By means of the buttons between the two list boxes, select all the file items that you wish to process, and from the section at the bottom right of the dialog choose whether to process all the dates (the default setting) or just one of them. Again your preference is retained between uses.

At the bottom of that selection is a text field that will show today's date. If you click in the date field a date selector pops up (courtesy of Trevor Eyre) allowing you to change to any other date of your preference.

If an item is selected in either of the lists, the file dates currently associated with that file are listed in the centre section below the lists. To draw attention to those date as they change, the text colour changes between blue and orange with each selection. as shown below:

By default, the current time is added to the date to process the file(s). Where multiple files are processed they are processed 1 second apart, which gives the results I was looking for.

If any of the files have the read-only attribute set, then the read-only attribute is removed from those files to allow the date to be reset, then re-applied. If the box 'Clear the read only attributes if originally set' is checked, the read-only attributes are not reset. This setting is retained until changed.

A progress indicator keeps track of progress and a log is produced to indicate what has occurred. The GM logo on the log, links to this page.

Also included in the lower section of the main dialog is a check box. When this box is checked ALL the files are given the same file time. By default this will be the time at which you check the box, but by selecting one or other of the three text boxes and using the spinner to raise or lower the number, you can set any time in the 24 hour clock. The current selection (hr.min/sec) is indicated by a light green coloured background.

I haven't gone overboard with the error checking on the dates (that may be a job for another day) so use some common sense when entering times or you will get an invalid result.

- Click here to download the add-in/template

 

 

 Background

The origins of the template featured here are somewhat self indulgent. I have a smart TV which acts as a DLNA client for my music and video collection, stored on a pair of NAS drives, that provide the bulk of my home entertainment.

The DNLA client indexing of the TV is frankly abysmal and it displays material in file date order, using the creation date and the last modified date (if later) to determine the displayed sort order. I therefore found myself spending too much time editing the file properties one at a time to get the files to display logically.

I produced the template to enable me to process a whole folder full of files with dates that reflect the required order.

It occurred to me that others might have the same Panasonic TV and thus have the same problem, or indeed may have a personal requirement to batch change file dates, so I have made it into a template which may be used as an add-in for Word.

Thanks are due to Chip Pearson for providing the core code, and to Trevor Eyre for providing the date picker function.