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

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:
Q128944 Handling Cross-Platform Differences in WordBasic


REFERENCES

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

Additional query words: 6.0 winword ntword wordnt macro wordbasic word6 appinfo appinfo$() appinfo$

Keywords : kbmacroexample
Version : WINDOWS:6.0,6.0a,6.0c; winnt:6.0
Platform : WINDOWS winnt
Issue type :


Last Reviewed: January 7, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.