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



The information in this article applies to:

  • Microsoft Excel for Windows 95
  • Microsoft Excel for Windows 5.0
  • Microsoft Excel for Windows 5.0c
  • Microsoft Excel for Windows NT 5.0

This article was previously published under Q136147

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:

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


Modification Type:MinorLast Reviewed:9/13/2006
Keywords:kbProgramming KB136147