So today when I saw something that look like this it made me smile:
Public Enum ExcelVersionEnum Excel4 = 4 Excel95 = 7 Excel97 = 8 Excel2000 = 9 Excelxp = 10 Excel2003 = 11 Excel2007 = 12 Excel2010 = 14 'Triskaidekaphobia! End Enum
There is no Excel version 13. I of course only just found this out when I encountered Excel 2010 which, I blush to admit, I have not downloaded from TechNet yet and played with.
Triskaidekaphobia (from Greek tris meaning “3,” kai meaning “and,” and deka meaning “10”) is fear of the number 13; it is a superstition and related to a specific fear of Friday the 13th, called paraskevidekatriaphobia or friggatriskaidekaphobia.
I remember using Application.Version calls in some very hacky code I had to change waaaay back as a graduate trainee ( little did I know then I would end up as a professional Excel developer).
Somewhat shocking for a massive investment bank, looking back on it, certain offices stubbornly refused to move away from Excel 95 & Excel 97. This was in 2004/2005 might I add!
So even using the most basic of built in VBA commands, would cause problems in release. We were on our lofty version of Excel 2000 so at that time only 4 or 5 years behind the curve rather than 7 or 8. Of course not even close to using 2003. It had ‘issues’ apparently. I think AsiaPac’s IT Director had ‘issues’ myself. Change = Work. Ahh .. Happy days.
Of course the rather inelegant solution to this was for me to remote into a test machine in Japan and then manually run my code and see what was breaking. Then, and I shudder as I write this, I would have to implement my own VBA versions of the calls that were not present in the old skool versions of Excel.
Mostly I leveraged off the pain of the previous people who did this and most of it could be found lying around the internet somewhere languishing on forums and boards from when the pain was still fresh i.e. circa 2001.
I would then of course have to Switch on Application.Version and call different Subs and Functions depending on what version was being run. Urgh.
Just thought I would share.