Using a Macro to Tell If 16- or 32-Bit Word Currently Running

Last reviewed: August 5, 1997
Article ID: Q123303
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows NT, version 6.0

SUMMARY

This article describes how to use the AppInfo$() function to return information about whether you are running the 16-bit version of Word (Word for Windows) or the 32-bit version of Word (Word for Windows NT). This information is important when you use macros that must access functions in Windows DLL files because 32-bit applications can only access 32-bit DLLs.

MORE INFORMATION

NOTE: This article assumes a basic working knowledge of WordBasic.

The AppInfo$() function can return one of 25 types of information about the Word application. To determine the operating system, which in turn indicates whether you are running the 16-bit or the 32-bit version, use the following command:

   AppInfo$(1)

  • If the 32-bit version of Word is running on Windows NT 3.5, AppInfo$(1) will return "Windows NT 3.50."
  • If the 16-bit version of Word is running on either Windows 3.1 or Windows NT 3.5, AppInfo$(1) will return "Windows 3.10."

    Although it appears that AppInfo$(1) cannot distinguish between the operating systems, the 16-bit version of Word is actually running in a Windows 3.1 subsystem of NT. Thus, AppInfo$(1) returns "Windows 3.10" because it is not a native 32-bit application. With this in mind, if the string returned by AppInfo$(1) contains "NT", the version of Word is the 32- bit version.

    The following macro example identifies the type of Word for Windows currently running:

    Sub MAIN
    
    System$ = AppInfo$(1) If Instr(System$,"NT") Then
       MsgBox "This is NT Word"
    
    Else
       MsgBox "This is 16-bit Word"
    End Sub
    
    
    WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    For additional information, please see the following article in the Microsoft Knowledge Base:

    ARTICLE-ID: Q128944

    TITLE     : Handling Cross-Platform Differences in WordBasic
    
    

    REFERENCES

    "Microsoft Word Developer's Kit," version 6.0, pages 258-259


  • KBCategory: kbmacro
    KBSubcategory: kbmacroexample
    Additional reference words: 6.0 6.0a 6.0c winword ntword wordnt macro
    wordbasic
    word6 appinfo appinfo$() appinfo$
    Keywords : kbmacroexample kbmacro
    Version : 6.0 6.0a 6.0c
    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: August 5, 1997
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.