Microsoft KB Archive/148717

= Macro Function to Determine If Environment Is 32-bit =

Article ID: 148717

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 5.0 Standard Edition

-



This article was previously published under Q148717



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. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.

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.00c API SDK 8.00 97 32bit 16bit xl97 XL

Keywords: kbhowto kbprogramming kbdtacode KB148717

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.