Application.OperatingSystem Returns Incorrect Value (111710)



The information in this article applies to:

  • Microsoft Excel for Windows 5.0

This article was previously published under Q111710

SYMPTOMS

In Microsoft Excel 5.0 for Windows, the OperatingSystem property of the Application object returns the name and version number of the current operating system. Depending on the operating system you are using, this property may return incorrect results.
   Operating System             OperatingSystem Property Returns
   --------------------------------------------------------------

   Microsoft Windows for         3.10
   Workgroups version 3.11

   Microsoft Windows 95          Windows 3.95

   Microsoft Windows NT 3.51     Windows 3.10.

				

Example

When you run the following Visual Basic procedure to display the current operating system in a dialog box, Microsoft Windows version 3.11 will be incorrectly identified as version 3.10. It will be referred to as Windows 3.95 under Microsoft Windows 95, and Windows 3.10 under Microsoft Windows NT.
   Sub ShowOS()
      Msgbox Application.OperatingSystem
   End Sub
				

CAUSE

Microsoft Excel 5.0 for Windows uses a GetVersion Windows application programming interface (API) call that returns version 3.10 from the kernel. The version that the kernel reports was not changed for this version of Microsoft Windows for Workgroups. Because Microsoft Excel version 5.0 was designed for a 16-bit operating system, GetVersion makes a 16-bit .dll call that returns invalid data under a 32-bit operating system.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Excel version 5.0. This problem was corrected in Microsoft Excel for Windows 95, version 7.0.

MORE INFORMATION

For additional information on running 16-bit versus 32-bit Microsoft Excel, please see the following article(s) in the Microsoft Knowledge Base:

136147 VB Macro to Tell If You Are Running 16-bit or 32-bit MS Excel

131525 XL: Can't Run Macro That Calls 16-bit DLL in 32-bit MS Excel

REFERENCES

Microsoft Press: "Excel 5 Visual Basic for Applications Reference," page 460

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbProgramming KB111710