In function GetOfficeName you should search in descending versions order, 14.0 first then lower. I had 2007 and installed 2010. The reg key InstallRoot is still present for 12.0. Your code will skip out when 12.0 is detected before 14.0 can be checked. I meant 15.0 then lower. But you understood ayway.
Hi, i think the bug is that you're using return for each detection. Try to use something else than a return to get office version. Actually if many versions were installed, somes keys could have been kept in the registry and the prog will return at the first key it has detected. I dont know if what i said can help you cuz i use to code C/C++ WinApi not C#... You can try a bool for each version and change em to 1 if detected: 0 not detected 1: detected
I support trying to use something else than a return to get office version, using code in c# is a little difficult, you need be patient.