XL: Macro Function to Determine If Environment Is 32-bit

Last reviewed: February 27, 1998
Article ID: Q148717

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

SUMMARY

This article contains information about how you can use Visual Basic for Applications macro code in Microsoft Excel to determine whether your macro environment is 16- or 32-bit.

MORE INFORMATION

Microsoft provides examples of Visual Basic for Applications 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. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

Visual Basic Code Example

   Function is32Bit() As Boolean
      is32Bit = False 'Assume Failure
      If InStr(1, Application.OperatingSystem, "32", 1) > 1 Then
         is32Bit = True
      End If
   End Function

   Sub TestIT()
      msgbox is32bit
   End Sub

Using the Example

Microsoft Excel 97:

   1. In Microsoft Excel, create a new workbook.

   2. Press ALT+F11 to start the Visual Basic Editor.

   3. On the Insert menu, click Module.

   4. Type the sample macro in the code window of the module.

   5. On the Tools menu, click Macros. Click TestIt and click Run.

   NOTE: When you run the macro, a message box appears. In the message
   box, True appears if you are using a 32-bit environment. False
   appears if you are using a 16-bit environment.

Microsoft Excel 5.0 and 7.0:

   1. In Microsoft Excel, create a new workbook.

   2. On the Insert menu, point to Macro, and then click Module.

   3. On the new module sheet, type the sample code in this article.

   4. On the Tools menu, click Macro. Click TestIt and click Run.

   NOTE: When you run Microsoft Excel version 5.0c (16-bit) under
   Windows 95 or Windows NT, this function returns False. This is by
   design because Microsoft Excel version 5.0c is a 16-bit application.

It may be possible to work around this situation by creating a macro that makes calls to the Windows application programming interface (API). This type of programming is supported by the Windows Software Development Kit (SDK) and the Visual Basic, Professional Edition, support groups. The level of support you can receive from these groups depends on the individual support policies of the group. (Microsoft Support Engineers may not be able to assist in specific construction of macros that use API programming.) If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee- based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.


Additional query words: 5.00 5.00c 7.00 API SDK 8.00 97 32bit 16bit
xl97
Keywords : kbcode kbprg kbhowto
Version : WINDOWS:5.0,7.0,97
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: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.