Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q282034

↑ Back to the top


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 "7.0," your code returns FALSE, as if Excel 2002 were not a later version than Microsoft Excel 7.0.

↑ Back to the top


Cause

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

↑ Back to the top


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
				

↑ Back to the top


Keywords: KB282034, kbprb, kbexpertisebeginner

↑ Back to the top

Article Info
Article ID : 282034
Revision : 7
Created on : 1/3/2007
Published on : 1/3/2007
Exists online : False
Views : 371