XL5: Application.OperatingSystem Returns Incorrect Value

ID: Q111710


The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0


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:

Q136147 VB Macro to Tell If You Are Running 16-bit or 32-bit MS Excel
Q131525 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

Additional query words:

Keywords : kbprg
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.