Microsoft KB Archive/282034

= You receive an unexpected result when you compare the results of the &quot;Application.Version&quot; property to another string value in Excel =

Article ID: 282034

Article Last Modified on 1/3/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition

-



This article was previously published under Q282034



SYMPTOMS
When you compare the results of the Application.Version property to another string value in Microsoft Excel, you receive an unexpected result.

For example, if you compare the results of the Application.Version property in Microsoft Excel 2002 to the number of an earlier version, such as &quot;7.0,&quot; your code returns FALSE, as if Excel 2002 were not a later version than Microsoft Excel 7.0.



CAUSE
Application.Version returns a String value instead of a numeric data type. Because the Excel 2002 version string is &quot;10.0,&quot; the following line of code evaluates to FALSE: Application.Version > &quot;7.0&quot; In a string comparison, &quot;10.0&quot; is less than &quot;7.0.&quot;



RESOLUTION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To evaluate the string that is returned by Application.Version as a number, use the Val function to convert the string to a number, as follows: Val(Application.Version) > 7

Additional query words: prb XL2002 XL2003 XL2007

Keywords: kbexpertisebeginner kbprb KB282034

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.