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

Last reviewed: September 2, 1997
Article ID: Q136147
The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for Windows, version 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:

ARTICLE ID: Q131525

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


Additional query words: 5.00 32bit 16bit howto
Keywords : kbprg PgmHowTo xlwin kbcode kbenv kbprg
Version : 5.00 5.00c 7.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.