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

ID: Q136147


The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows NT, version 5.0


SUMMARY

This article includes a sample Visual Basic, Applications Edition, procedure that can be used to determine whether the version of Microsoft Excel that is running is the 16-bit or the 32-bit version.

Sample Visual Basic, Applications Edition, Procedure

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

Sub Excel_16or32bit()

Dim opsys32bit As Boolean

    'set opsys32bit true if "32-bit" found in operating system string
    'False otherwise
    opsys32bit = Application.OperatingSystem Like "*32-bit*"
    'If true
    If opsys32bit Then
        'Call the 32-bit function here
        MsgBox "You are running 32-bit Microsoft Excel."
    Else
        'otherwise call the 16-bit function here
        MsgBox "You are running 16-bit Microsoft Excel."
    End If
End Sub 


MORE INFORMATION

For additional information about running macros that call DLLs in Microsoft Excel, please see the following article in the Microsoft Knowledge Base:

Q131525Can't Run Macro That Calls 16-bit DLL in 32-bit MS Excel

Additional query words: 32bit 16bit howto

Keywords : kbprg xlwin
Version : WINDOWS:5.0,5.0c,7.0; winnt:5.0
Platform : WINDOWS winnt
Issue type :


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