Adding a date to the front of the filename of a Word document

I frequently receive translations as documents from colleagues with ambiguous filenames like: “Übersetzung.docx” – and more often than not they are for small translation “snippets” – from a couple of sentences to a couple of paragraphs. I like to run a couple of macros in Word before I translate – most notably to change non-breaking hyphens into normal ones.

In addition though, to help with aligning documents to dates received, I have a little macro that I use that saves the file with a date prefixed into the filename from inside Word. This helps in particular for short snippets that are not translated as separate projects in Trados, but dragged into a project made up of short translations.

Sub DateFN()
If ActiveDocument.Name = ActiveDocument.FullName Then
    If Not Application.Dialogs(wdDialogFileSaveAs).Show Then Exit Sub
End If
    CurrentFormat = ActiveDocument.SaveFormat
    CurrentPathAndName = ActiveDocument.FullName
    CurrentPath = Replace(ActiveDocument.FullName, ActiveDocument.Name, "")
    NewNameSamePath = CurrentPath & Format(Now, "yymmdd") & " - " & ActiveDocument.Name
    ActiveDocument.SaveAs FileName:=NewNameSamePath, FileFormat:=CurrentFormat
    Kill CurrentPathAndName
End Sub

Why do I use the YYMMDD date format?

I chose this particular date format, although YYYYMMDD would work just as well as it is easiest to sort filenames that start with years followed months and then days.

Visited 7 times, 1 visit(s) today