Get Excel version with Service pack RRS feed

  • Question

  • Hello

    I need to retrieve the excel version where my addin is running. I cannot just show the build number, i have to show the version in a friendlier way:

    string excelVersion = System.Windows.Forms.Application.ProductVersion.ToString();

    if (excelVersion.StartsWith("5.0")) excelVersion = "Excel 5";
    if (excelVersion.StartsWith("7.0")) excelVersion = "Excel 95";
    if (excelVersion.StartsWith("8.0")) excelVersion = "Excel 97";
    if (excelVersion.StartsWith("9.0")) excelVersion = "Excel 2000";
    if (excelVersion.StartsWith("10.0")) excelVersion = "Excel 2002";
    if (excelVersion.StartsWith("11.0")) excelVersion = "Excel 2003";
    if (excelVersion.StartsWith("12.0")) excelVersion = "Excel 2007";
    if (excelVersion.StartsWith("14.0")) excelVersion = "Excel 2010";

    Which gives me the initial info for the excel version, but i don't know how to identify which service pack it is installed.
    The idea is to show the user something like "Excel 2010 SP 2"

    I know the way i've been doing things don't seem to be the most efficient, but so far i don't know of any property that would provide me with what i need.

    Is there maybe a way to determine the service pack based on the build number? or is there maybe another more efficient way of archiving this?


    Tuesday, October 4, 2011 10:36 PM


All replies

  • I hope this helps.


            private void Sheet1_Startup(object sender, System.EventArgs e)
    Wednesday, October 5, 2011 12:42 AM
  • Hi

    Thanks for your response. But this only gives me the version and build number (e.g. 4756). What i want to show to the user is "Service Pack 2" instead. I could do that if i knew what service pack version 14.0.4756 is, but i would need to have the info for all excel versions, so if for instance the version gives me something like 9.0.4561 i would show to the user something like "Excel 2000 Service pack 3"


    Wednesday, October 5, 2011 2:02 PM

    After checking your reply, I searched  about Build Number.

    I couldn't find detailed information but, I think below link is kind of useful to you.

    I created simple source using the post of above link with Excel 2007.

    I don't know well. But I guess Build Number starts from 6 in SP2.

    I think there is a better way than my source.


            private string ExcelInformation(string Ver, int build)
                string xlInfo = string.Empty;
                switch (Ver)
                    case "12.0" :
                        xlInfo = "Excel 2007";
                    case "14.0":
                        xlInfo = "Excel 2010";
                if (build.ToString().StartsWith("6"))
                    xlInfo += " sp2";
                return xlInfo;
     MessageBox.Show( ExcelInformation(this.Application.Version, this.Application.Build));

  2010 2007 2003



    • Edited by VSTO_Beginner Friday, October 7, 2011 12:06 AM add link
    • Marked as answer by Bruce Song Thursday, October 20, 2011 12:04 PM
    Thursday, October 6, 2011 1:33 AM