Adobe Standard “Bug”, Armenian Dates

I’ve been working on a project that involves saving an Adode pdf as an excel spreadsheet. Adobe Standard 10, exports dates into Excel cells and formats the cells in different “Locales (locations)”. I ended up with English (Caribbean) and Armenian formatted date cells. This makes it difficult because Armenian dates are formatted day/month/year while English (Caribbean) dates are formatted month/day/year. The information needs to be imported into a data table which makes the above even more difficult.
Everything I tried did not correct the issue so I “asked the internet”. The result was seeing a lot of people with the same issue but no solution. After a lot of failures, I finally looked at it differently.

I’m posting this for others whom are looking for the same solution.
dteExpireDate is a Date variable
i is a integer variable that builds in a FOR loop (Changes cell locations)
Plain English: If the date is formatted day/month/year, change it to month/day/year, otherwise, keep it as month/day/year.

VBA Code:

        If WkBk.Sheets(1).Range("C" & i).NumberFormat = "dd/mm/yyyy;@" Then
            dtenExpireDate = WkBk.Sheets(1).Range("C" & i).Value
            dteExpireDate = Day(dtenExpireDate) & "/" _
                                     & Month(dtenExpireDate) & "/" _
                                     & Year(dteExpireDate)
        Else
            dtenExpireDate = WkBk.Sheets(1).Range("C" & i).Value
            dteExpireDate = Month(dteExpireDate) & "/" _
                                     & Day(dteExpireDate) & "/" _
                                     & Year(dteExpireDate)
        End If

Leave a comment