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

ID: Q148717

The information in this article applies to:

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 programming examples 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/

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 professionals 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          : kbprg kbdta kbdtacode KbVBA kbhowto 
Version           : WINDOWS:5.0,7.0,97
Platform          : WINDOWS

Last Reviewed: May 17, 1999