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

ID: Q136147

The information in this article applies to:

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 xlwin 
Version           : 5.00 5.00c 7.00
Platform          : WINDOWS

Last Reviewed: November 18, 1998